增加缓存上传最小文件尺寸的限制(默认16KB),增加最大suspend数的限制(默认1百万)
This commit is contained in:
@@ -82,6 +82,7 @@ struct cache_param
|
||||
time_t inactive_time_sec;
|
||||
size_t max_cache_size;
|
||||
size_t max_cache_obj_size;
|
||||
size_t min_cache_obj_size;
|
||||
pthread_mutex_t lock;
|
||||
};
|
||||
struct cache_bloom
|
||||
@@ -573,6 +574,9 @@ void cache_param_new(int idx, const struct Maat_rule_t* rule, const char* srv_de
|
||||
|
||||
item=cJSON_GetObjectItem(json,"max_cache_obj_size");
|
||||
if(item && item->type==cJSON_String) param->max_cache_obj_size=storage_unit_byte(item->valuestring);
|
||||
|
||||
item=cJSON_GetObjectItem(json,"min_cache_obj_size");
|
||||
if(item && item->type==cJSON_String) param->min_cache_obj_size=storage_unit_byte(item->valuestring);
|
||||
|
||||
cJSON_Delete(json);
|
||||
*ad=param;
|
||||
@@ -723,11 +727,16 @@ struct cache_handle* create_web_cache_handle(const char* profile_path, const cha
|
||||
cache->default_cache_policy.ignore_req_nocache=0;
|
||||
cache->default_cache_policy.ignore_res_nocache=0;
|
||||
cache->default_cache_policy.force_caching=0;
|
||||
cache->default_cache_policy.min_use=0;
|
||||
cache->default_cache_policy.pinning_time_sec=0;
|
||||
cache->default_cache_policy.inactive_time_sec=0;
|
||||
cache->default_cache_policy.max_cache_size=0;
|
||||
cache->default_cache_policy.max_cache_obj_size=1024*1024*1024;//<1GB by default
|
||||
|
||||
MESA_load_profile_int_def(profile_path, section, "min_use", &(cache->default_cache_policy.min_use), 0);
|
||||
MESA_load_profile_int_def(profile_path, section, "max_cache_obj_size", &(temp), 1024*1024*1024);
|
||||
cache->default_cache_policy.max_cache_obj_size=temp; //<1GB by default
|
||||
|
||||
MESA_load_profile_int_def(profile_path, section, "min_cache_obj_size", &(temp), 16*1024);
|
||||
cache->default_cache_policy.min_cache_obj_size=temp;// > 16kb by default
|
||||
|
||||
if(cache->cache_policy_enabled)
|
||||
{
|
||||
@@ -1246,6 +1255,7 @@ struct cache_update_context* web_cache_write_start(struct cache_handle* handle,
|
||||
case UNDEFINED:
|
||||
if(_mid->shall_bypass
|
||||
|| (param->max_cache_obj_size!=0 && content_len > param->max_cache_obj_size)
|
||||
|| (param->min_cache_obj_size > content_len)
|
||||
|| (!param->cache_cookied_cont && _mid->has_cookie)
|
||||
|| (!param->cache_html && _mid->is_html))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user