comparison 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
comparison
equal deleted inserted replaced
3698:d11227f0107f 3699:b0a0686a85bb
44 ngx_str_t *path); 44 ngx_str_t *path);
45 45
46 46
47 ngx_str_t ngx_http_cache_status[] = { 47 ngx_str_t ngx_http_cache_status[] = {
48 ngx_string("MISS"), 48 ngx_string("MISS"),
49 ngx_string("BYPASS"),
49 ngx_string("EXPIRED"), 50 ngx_string("EXPIRED"),
50 ngx_string("STALE"), 51 ngx_string("STALE"),
51 ngx_string("UPDATING"), 52 ngx_string("UPDATING"),
52 ngx_string("HIT") 53 ngx_string("HIT")
53 }; 54 };
158 return NGX_ERROR; 159 return NGX_ERROR;
159 } 160 }
160 161
161 r->cache = c; 162 r->cache = c;
162 c->file.log = r->connection->log; 163 c->file.log = r->connection->log;
164
165 return NGX_OK;
166 }
167
168
169 ngx_int_t
170 ngx_http_file_cache_create(ngx_http_request_t *r)
171 {
172 ngx_http_cache_t *c;
173 ngx_pool_cleanup_t *cln;
174 ngx_http_file_cache_t *cache;
175
176 ngx_http_file_cache_create_key(r);
177
178 c = r->cache;
179 cache = c->file_cache;
180
181 cln = ngx_pool_cleanup_add(r->pool, 0);
182 if (cln == NULL) {
183 return NGX_ERROR;
184 }
185
186 if (ngx_http_file_cache_exists(cache, c) == NGX_ERROR) {
187 return NGX_ERROR;
188 }
189
190 cln->handler = ngx_http_file_cache_cleanup;
191 cln->data = c;
192
193 if (ngx_http_file_cache_name(r, cache->path) != NGX_OK) {
194 return NGX_ERROR;
195 }
163 196
164 return NGX_OK; 197 return NGX_OK;
165 } 198 }
166 199
167 200