]> git.kaiwu.me - nginx.git/commitdiff
count cache key node usage for cached error statuses
authorIgor Sysoev <igor@sysoev.ru>
Fri, 30 Jul 2010 12:41:55 +0000 (12:41 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Fri, 30 Jul 2010 12:41:55 +0000 (12:41 +0000)
src/http/ngx_http_file_cache.c

index 4d847342531fd8c49207b2237ea3eddd26c93c0f..6d39269e3320ef5836b7893f1a929216cbcfe065 100644 (file)
@@ -519,6 +519,9 @@ ngx_http_file_cache_exists(ngx_http_file_cache_t *cache, ngx_http_cache_t *c)
     if (fcn) {
         ngx_queue_remove(&fcn->queue);
 
+        fcn->uses++;
+        fcn->count++;
+
         if (fcn->error) {
 
             if (fcn->valid_sec < ngx_time()) {
@@ -530,9 +533,6 @@ ngx_http_file_cache_exists(ngx_http_file_cache_t *cache, ngx_http_cache_t *c)
             goto done;
         }
 
-        fcn->uses++;
-        fcn->count++;
-
         if (fcn->exists) {
 
             c->exists = fcn->exists;
@@ -581,12 +581,13 @@ ngx_http_file_cache_exists(ngx_http_file_cache_t *cache, ngx_http_cache_t *c)
 
     ngx_rbtree_insert(&cache->sh->rbtree, &fcn->node);
 
+    fcn->uses = 1;
+    fcn->count = 1;
+
 renew:
 
     rc = NGX_DECLINED;
 
-    fcn->uses = 1;
-    fcn->count = 1;
     fcn->valid_msec = 0;
     fcn->error = 0;
     fcn->exists = 0;