diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2009-08-28 11:23:50 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2009-08-28 11:23:50 +0000 |
| commit | 8b8e995eb89d881a09dad054915bf09f7de01555 (patch) | |
| tree | 5f9549ea2ae5a458935833475651add524f0d2f8 | |
| parent | a39d4e1aeee5e6608c5ffc5cb3e02877e41515a9 (diff) | |
| download | nginx-8b8e995eb89d881a09dad054915bf09f7de01555.tar.gz nginx-8b8e995eb89d881a09dad054915bf09f7de01555.tar.bz2 | |
do not create cache key in AIO invocation
| -rw-r--r-- | src/http/ngx_http_upstream.c | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index 6dcebd0a5..9aa797ac0 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -380,6 +380,10 @@ ngx_http_upstream_create(ngx_http_request_t *r) u->peer.lock = &r->connection->lock; #endif +#if (NGX_HTTP_CACHE) + r->cache = NULL; +#endif + return NGX_OK; } @@ -607,41 +611,46 @@ ngx_http_upstream_cache(ngx_http_request_t *r, ngx_http_upstream_t *u) ngx_int_t rc; ngx_http_cache_t *c; - if (!(r->method & u->conf->cache_methods)) { - return NGX_DECLINED; - } - - if (r->method & NGX_HTTP_HEAD) { - u->method = ngx_http_core_get_method; - } + c = r->cache; - c = ngx_pcalloc(r->pool, sizeof(ngx_http_cache_t)); if (c == NULL) { - return NGX_ERROR; - } - if (ngx_array_init(&c->keys, r->pool, 4, sizeof(ngx_str_t)) != NGX_OK) { - return NGX_ERROR; - } + if (!(r->method & u->conf->cache_methods)) { + return NGX_DECLINED; + } - r->cache = c; - c->file.log = r->connection->log; + if (r->method & NGX_HTTP_HEAD) { + u->method = ngx_http_core_get_method; + } - if (u->create_key(r) != NGX_OK) { - return NGX_ERROR; - } + c = ngx_pcalloc(r->pool, sizeof(ngx_http_cache_t)); + if (c == NULL) { + return NGX_ERROR; + } - /* TODO: add keys */ + if (ngx_array_init(&c->keys, r->pool, 4, sizeof(ngx_str_t)) != NGX_OK) { + return NGX_ERROR; + } - ngx_http_file_cache_create_key(r); + r->cache = c; + c->file.log = r->connection->log; - u->cacheable = 1; + if (u->create_key(r) != NGX_OK) { + return NGX_ERROR; + } + + /* TODO: add keys */ - c->min_uses = u->conf->cache_min_uses; - c->body_start = u->conf->buffer_size; - c->file_cache = u->conf->cache->data; + ngx_http_file_cache_create_key(r); - u->cache_status = NGX_HTTP_CACHE_MISS; + u->cacheable = 1; + + c->min_uses = u->conf->cache_min_uses; + c->body_start = u->conf->buffer_size; + c->file_cache = u->conf->cache->data; + + u->cache_status = NGX_HTTP_CACHE_MISS; + } rc = ngx_http_file_cache_open(r); |
