Mercurial > hg > nginx
diff src/http/ngx_http_file_cache.c @ 3699:b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 19 Jul 2010 09:36:04 +0000 |
parents | d11227f0107f |
children | f220e5a5fb5e |
line wrap: on
line diff
--- a/src/http/ngx_http_file_cache.c +++ b/src/http/ngx_http_file_cache.c @@ -46,6 +46,7 @@ static ngx_int_t ngx_http_file_cache_del ngx_str_t ngx_http_cache_status[] = { ngx_string("MISS"), + ngx_string("BYPASS"), ngx_string("EXPIRED"), ngx_string("STALE"), ngx_string("UPDATING"), @@ -165,6 +166,38 @@ ngx_http_file_cache_new(ngx_http_request } +ngx_int_t +ngx_http_file_cache_create(ngx_http_request_t *r) +{ + ngx_http_cache_t *c; + ngx_pool_cleanup_t *cln; + ngx_http_file_cache_t *cache; + + ngx_http_file_cache_create_key(r); + + c = r->cache; + cache = c->file_cache; + + cln = ngx_pool_cleanup_add(r->pool, 0); + if (cln == NULL) { + return NGX_ERROR; + } + + if (ngx_http_file_cache_exists(cache, c) == NGX_ERROR) { + return NGX_ERROR; + } + + cln->handler = ngx_http_file_cache_cleanup; + cln->data = c; + + if (ngx_http_file_cache_name(r, cache->path) != NGX_OK) { + return NGX_ERROR; + } + + return NGX_OK; +} + + void ngx_http_file_cache_create_key(ngx_http_request_t *r) {