comparison src/http/ngx_http_upstream.c @ 5950:eaeecf00d5d7

Upstream: preset some cache configuration when bypassing. No functional changes.
author Valentin Bartenev <vbart@nginx.com>
date Mon, 22 Dec 2014 12:59:06 +0300
parents 634da79665d3
children 610832763648
comparison
equal deleted inserted replaced
5949:634da79665d3 5950:eaeecf00d5d7
761 return NGX_DECLINED; 761 return NGX_DECLINED;
762 } 762 }
763 763
764 u->cacheable = 1; 764 u->cacheable = 1;
765 765
766 c = r->cache;
767
768 c->body_start = u->conf->buffer_size;
769 c->min_uses = u->conf->cache_min_uses;
770 c->file_cache = u->conf->cache_zone->data;
771
766 switch (ngx_http_test_predicates(r, u->conf->cache_bypass)) { 772 switch (ngx_http_test_predicates(r, u->conf->cache_bypass)) {
767 773
768 case NGX_ERROR: 774 case NGX_ERROR:
769 return NGX_ERROR; 775 return NGX_ERROR;
770 776
773 return NGX_DECLINED; 779 return NGX_DECLINED;
774 780
775 default: /* NGX_OK */ 781 default: /* NGX_OK */
776 break; 782 break;
777 } 783 }
778
779 c = r->cache;
780
781 c->min_uses = u->conf->cache_min_uses;
782 c->body_start = u->conf->buffer_size;
783 c->file_cache = u->conf->cache_zone->data;
784 784
785 c->lock = u->conf->cache_lock; 785 c->lock = u->conf->cache_lock;
786 c->lock_timeout = u->conf->cache_lock_timeout; 786 c->lock_timeout = u->conf->cache_lock_timeout;
787 c->lock_age = u->conf->cache_lock_age; 787 c->lock_age = u->conf->cache_lock_age;
788 788
2534 2534
2535 default: /* NGX_OK */ 2535 default: /* NGX_OK */
2536 2536
2537 if (u->cache_status == NGX_HTTP_CACHE_BYPASS) { 2537 if (u->cache_status == NGX_HTTP_CACHE_BYPASS) {
2538 2538
2539 r->cache->min_uses = u->conf->cache_min_uses; 2539 /* create cache if previously bypassed */
2540 r->cache->body_start = u->conf->buffer_size;
2541 r->cache->file_cache = u->conf->cache_zone->data;
2542 2540
2543 if (ngx_http_file_cache_create(r) != NGX_OK) { 2541 if (ngx_http_file_cache_create(r) != NGX_OK) {
2544 ngx_http_upstream_finalize_request(r, u, NGX_ERROR); 2542 ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
2545 return; 2543 return;
2546 } 2544 }