Welcome! Log In Create A New Profile

Advanced

[nginx] Upstream: preset some cache configuration when bypassing.

Valentin Bartenev
December 22, 2014 05:02AM
details: http://hg.nginx.org/nginx/rev/eaeecf00d5d7
branches:
changeset: 5950:eaeecf00d5d7
user: Valentin Bartenev <vbart@nginx.com>
date: Mon Dec 22 12:59:06 2014 +0300
description:
Upstream: preset some cache configuration when bypassing.

No functional changes.

diffstat:

src/http/ngx_http_upstream.c | 16 +++++++---------
1 files changed, 7 insertions(+), 9 deletions(-)

diffs (40 lines):

diff -r 634da79665d3 -r eaeecf00d5d7 src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c Mon Dec 22 12:59:02 2014 +0300
+++ b/src/http/ngx_http_upstream.c Mon Dec 22 12:59:06 2014 +0300
@@ -763,6 +763,12 @@ ngx_http_upstream_cache(ngx_http_request

u->cacheable = 1;

+ c = r->cache;
+
+ c->body_start = u->conf->buffer_size;
+ c->min_uses = u->conf->cache_min_uses;
+ c->file_cache = u->conf->cache_zone->data;
+
switch (ngx_http_test_predicates(r, u->conf->cache_bypass)) {

case NGX_ERROR:
@@ -776,12 +782,6 @@ ngx_http_upstream_cache(ngx_http_request
break;
}

- c = r->cache;
-
- c->min_uses = u->conf->cache_min_uses;
- c->body_start = u->conf->buffer_size;
- c->file_cache = u->conf->cache_zone->data;
-
c->lock = u->conf->cache_lock;
c->lock_timeout = u->conf->cache_lock_timeout;
c->lock_age = u->conf->cache_lock_age;
@@ -2536,9 +2536,7 @@ ngx_http_upstream_send_response(ngx_http

if (u->cache_status == NGX_HTTP_CACHE_BYPASS) {

- r->cache->min_uses = u->conf->cache_min_uses;
- r->cache->body_start = u->conf->buffer_size;
- r->cache->file_cache = u->conf->cache_zone->data;
+ /* create cache if previously bypassed */

if (ngx_http_file_cache_create(r) != NGX_OK) {
ngx_http_upstream_finalize_request(r, u, NGX_ERROR);

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Upstream: preset some cache configuration when bypassing.

Valentin Bartenev 666 December 22, 2014 05:02AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 153
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready