do not create cache key in AIO invocation
This commit is contained in:
parent
d4098ed5af
commit
21e795c0cb
1 changed files with 41 additions and 32 deletions
|
@ -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,42 +611,47 @@ 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;
|
||||
}
|
||||
c = r->cache;
|
||||
|
||||
if (r->method & NGX_HTTP_HEAD) {
|
||||
u->method = ngx_http_core_get_method;
|
||||
}
|
||||
|
||||
c = ngx_pcalloc(r->pool, sizeof(ngx_http_cache_t));
|
||||
if (c == NULL) {
|
||||
return NGX_ERROR;
|
||||
|
||||
if (!(r->method & u->conf->cache_methods)) {
|
||||
return NGX_DECLINED;
|
||||
}
|
||||
|
||||
if (r->method & NGX_HTTP_HEAD) {
|
||||
u->method = ngx_http_core_get_method;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
r->cache = c;
|
||||
c->file.log = r->connection->log;
|
||||
|
||||
if (u->create_key(r) != NGX_OK) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
/* TODO: add keys */
|
||||
|
||||
ngx_http_file_cache_create_key(r);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (ngx_array_init(&c->keys, r->pool, 4, sizeof(ngx_str_t)) != NGX_OK) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
r->cache = c;
|
||||
c->file.log = r->connection->log;
|
||||
|
||||
if (u->create_key(r) != NGX_OK) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
/* TODO: add keys */
|
||||
|
||||
ngx_http_file_cache_create_key(r);
|
||||
|
||||
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);
|
||||
|
||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||
|
|
Loading…
Reference in a new issue