open_file_cache_retest > open_file_cache_valid

This commit is contained in:
Igor Sysoev 2007-12-21 16:19:48 +00:00
parent f2d60afc7c
commit 9b9616e5ac
8 changed files with 24 additions and 13 deletions

View File

@ -189,7 +189,7 @@ ngx_open_cached_file(ngx_open_file_cache_t *cache, ngx_str_t *name,
ngx_queue_remove(&file->queue);
if (file->event || now - file->created < of->retest) {
if (file->event || now - file->created < of->valid) {
if (file->err == 0) {
of->fd = file->fd;
of->uniq = file->uniq;

View File

@ -19,7 +19,7 @@ typedef struct {
off_t size;
ngx_err_t err;
time_t retest;
time_t valid;
unsigned test_dir:1;
unsigned errors:1;

View File

@ -106,7 +106,7 @@ ngx_http_flv_handler(ngx_http_request_t *r)
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
of.test_dir = 0;
of.retest = clcf->open_file_cache_retest;
of.valid = clcf->open_file_cache_valid;
of.errors = clcf->open_file_cache_errors;
of.events = clcf->open_file_cache_events;

View File

@ -209,7 +209,7 @@ ngx_http_index_handler(ngx_http_request_t *r)
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "open index \"%V\"", &path);
of.test_dir = 0;
of.retest = clcf->open_file_cache_retest;
of.valid = clcf->open_file_cache_valid;
of.errors = clcf->open_file_cache_errors;
of.events = clcf->open_file_cache_events;
@ -292,7 +292,7 @@ ngx_http_index_test_dir(ngx_http_request_t *r, ngx_http_core_loc_conf_t *clcf,
"http index check dir: \"%V\"", &dir);
of.test_dir = 1;
of.retest = clcf->open_file_cache_retest;
of.valid = clcf->open_file_cache_valid;
of.errors = clcf->open_file_cache_errors;
if (ngx_open_cached_file(clcf->open_file_cache, &dir, &of, r->pool)

View File

@ -97,7 +97,7 @@ ngx_http_static_handler(ngx_http_request_t *r)
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
of.test_dir = 0;
of.retest = clcf->open_file_cache_retest;
of.valid = clcf->open_file_cache_valid;
of.errors = clcf->open_file_cache_errors;
of.events = clcf->open_file_cache_events;

View File

@ -85,6 +85,10 @@ static ngx_conf_deprecated_t ngx_conf_deprecated_optimize_host_names = {
ngx_conf_deprecated, "optimize_host_names", "optimize_server_names"
};
static ngx_conf_deprecated_t ngx_conf_deprecated_open_file_cache_retest = {
ngx_conf_deprecated, "open_file_cache_retest", "open_file_cache_valid"
};
static ngx_conf_enum_t ngx_http_core_request_body_in_file[] = {
{ ngx_string("off"), NGX_HTTP_REQUEST_BODY_FILE_OFF },
@ -473,12 +477,19 @@ static ngx_command_t ngx_http_core_commands[] = {
offsetof(ngx_http_core_loc_conf_t, open_file_cache),
NULL },
{ ngx_string("open_file_cache_valid"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ngx_conf_set_sec_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_core_loc_conf_t, open_file_cache_valid),
NULL },
{ ngx_string("open_file_cache_retest"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ngx_conf_set_sec_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_core_loc_conf_t, open_file_cache_retest),
NULL },
offsetof(ngx_http_core_loc_conf_t, open_file_cache_valid),
&ngx_conf_deprecated_open_file_cache_retest },
{ ngx_string("open_file_cache_errors"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
@ -2417,7 +2428,7 @@ ngx_http_core_create_loc_conf(ngx_conf_t *cf)
lcf->types_hash_max_size = NGX_CONF_UNSET_UINT;
lcf->types_hash_bucket_size = NGX_CONF_UNSET_UINT;
lcf->open_file_cache = NGX_CONF_UNSET_PTR;
lcf->open_file_cache_retest = NGX_CONF_UNSET;
lcf->open_file_cache_valid = NGX_CONF_UNSET;
lcf->open_file_cache_errors = NGX_CONF_UNSET;
lcf->open_file_cache_events = NGX_CONF_UNSET;
@ -2620,8 +2631,8 @@ ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_conf_merge_ptr_value(conf->open_file_cache,
prev->open_file_cache, NULL);
ngx_conf_merge_sec_value(conf->open_file_cache_retest,
prev->open_file_cache_retest, 60);
ngx_conf_merge_sec_value(conf->open_file_cache_valid,
prev->open_file_cache_valid, 60);
ngx_conf_merge_sec_value(conf->open_file_cache_errors,
prev->open_file_cache_errors, 0);

View File

@ -295,7 +295,7 @@ struct ngx_http_core_loc_conf_s {
ngx_path_t *client_body_temp_path; /* client_body_temp_path */
ngx_open_file_cache_t *open_file_cache;
time_t open_file_cache_retest;
time_t open_file_cache_valid;
ngx_flag_t open_file_cache_errors;
ngx_flag_t open_file_cache_events;

View File

@ -976,7 +976,7 @@ ngx_http_script_file_code(ngx_http_script_engine_t *e)
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
of.test_dir = 0;
of.retest = clcf->open_file_cache_retest;
of.valid = clcf->open_file_cache_valid;
of.errors = clcf->open_file_cache_errors;
of.events = clcf->open_file_cache_events;