diff src/http/ngx_http_file_cache.c @ 466:9eda3153223b NGINX_0_7_45

nginx 0.7.45 *) Change: now the "proxy_cache" and the "proxy_cache_valid" can be set on different levels. *) Change: the "clean_time" parameter of the "proxy_cache_path" directive is canceled. *) Feature: the "max_size" parameter of the "proxy_cache_path" directive. *) Feature: the ngx_http_fastcgi_module preliminary cache support. *) Feature: now on shared memory allocation errors directive and zone names are logged. *) Bugfix: the directive "add_header last-modified ''" did not delete a "Last-Modified" response header line; the bug had appeared in 0.7.44. *) Bugfix: a relative path in the "auth_basic_user_file" directive given without variables did not work; the bug had appeared in 0.7.44. Thanks to Jerome Loyet. *) Bugfix: in an "alias" directive given using variables without references to captures of regular expressions; the bug had appeared in 0.7.42.
author Igor Sysoev <http://sysoev.ru>
date Mon, 30 Mar 2009 00:00:00 +0400
parents c8cfb6c462ef
children 56baf312c1b5
line wrap: on
line diff
--- a/src/http/ngx_http_file_cache.c
+++ b/src/http/ngx_http_file_cache.c
@@ -251,6 +251,7 @@ ngx_http_file_cache_open(ngx_http_reques
                    "http file cache fd: %d", of.fd);
 
     c->file.fd = of.fd;
+    c->file.log = r->connection->log;
 
     c->buf = ngx_create_temp_buf(r->pool, c->body_start);
     if (c->buf == NULL) {
@@ -355,10 +356,7 @@ ngx_http_file_cache_exists(ngx_http_requ
         if (fcn->uses >= r->cache->min_uses) {
 
             r->cache->exists = fcn->exists;
-
-            if (fcn->body_start) {
-                r->cache->body_start = fcn->body_start;
-            }
+            r->cache->body_start = fcn->body_start;
 
             rc = NGX_OK;
 
@@ -816,8 +814,8 @@ ngx_http_file_cache_expire(ngx_http_file
                 ngx_rbtree_delete(cache->rbtree, &fcn->node);
 
                 ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0,
-                              "ignore long locked inactive cache entry %*s",
-                              NGX_HTTP_CACHE_KEY_LEN, key);
+                       "ignore long locked inactive cache entry %*s, count:%d",
+                       2 * NGX_HTTP_CACHE_KEY_LEN, key, fcn->count);
             }
 
             if (tries++ < 10) {
@@ -895,8 +893,9 @@ ngx_http_file_cache_cleaner(void *data)
 
     now = ngx_time();
 
-    if (now >= cache->next_clean_time) {
-
+    if (now >= cache->next_clean_time
+        && now >= cache->created + cache->inactive)
+    {
         ngx_log_error(NGX_LOG_NOTICE, ngx_cycle->log, 0,
                       "clean unused cache files");