comparison src/http/ngx_http_file_cache.c @ 3724:e9f0a2497d3c

count cache key node usage for cached error statuses
author Igor Sysoev <igor@sysoev.ru>
date Fri, 30 Jul 2010 12:41:55 +0000
parents 14ad3210fc73
children 282ddd49f925
comparison
equal deleted inserted replaced
3723:14ad3210fc73 3724:e9f0a2497d3c
517 fcn = ngx_http_file_cache_lookup(cache, c->key); 517 fcn = ngx_http_file_cache_lookup(cache, c->key);
518 518
519 if (fcn) { 519 if (fcn) {
520 ngx_queue_remove(&fcn->queue); 520 ngx_queue_remove(&fcn->queue);
521 521
522 fcn->uses++;
523 fcn->count++;
524
522 if (fcn->error) { 525 if (fcn->error) {
523 526
524 if (fcn->valid_sec < ngx_time()) { 527 if (fcn->valid_sec < ngx_time()) {
525 goto renew; 528 goto renew;
526 } 529 }
527 530
528 rc = NGX_OK; 531 rc = NGX_OK;
529 532
530 goto done; 533 goto done;
531 } 534 }
532
533 fcn->uses++;
534 fcn->count++;
535 535
536 if (fcn->exists) { 536 if (fcn->exists) {
537 537
538 c->exists = fcn->exists; 538 c->exists = fcn->exists;
539 c->body_start = fcn->body_start; 539 c->body_start = fcn->body_start;
579 ngx_memcpy(fcn->key, &c->key[sizeof(ngx_rbtree_key_t)], 579 ngx_memcpy(fcn->key, &c->key[sizeof(ngx_rbtree_key_t)],
580 NGX_HTTP_CACHE_KEY_LEN - sizeof(ngx_rbtree_key_t)); 580 NGX_HTTP_CACHE_KEY_LEN - sizeof(ngx_rbtree_key_t));
581 581
582 ngx_rbtree_insert(&cache->sh->rbtree, &fcn->node); 582 ngx_rbtree_insert(&cache->sh->rbtree, &fcn->node);
583 583
584 renew:
585
586 rc = NGX_DECLINED;
587
588 fcn->uses = 1; 584 fcn->uses = 1;
589 fcn->count = 1; 585 fcn->count = 1;
586
587 renew:
588
589 rc = NGX_DECLINED;
590
590 fcn->valid_msec = 0; 591 fcn->valid_msec = 0;
591 fcn->error = 0; 592 fcn->error = 0;
592 fcn->exists = 0; 593 fcn->exists = 0;
593 fcn->valid_sec = 0; 594 fcn->valid_sec = 0;
594 fcn->uniq = 0; 595 fcn->uniq = 0;