http {
...
server {
...
location /good {
proxy_cache mycache;
proxy_cache_key $arg_cachekey;
proxy_cache_valid 200 1h;
proxy_cache_lock on;
proxy_cache_lock_timeout 20m;
proxy_cache_lock_age 20m;
...
(upstream returning 200 with the content)
}
location /bad {
proxy_cache mycache;
proxy_cache_key $arg_cachekey;
proxy_cache_lock on;
proxy_cache_lock_timeout 20m;
proxy_cache_lock_age 20m;
...
(upstream returning 404)
}
}
}
缓存是空的。请求:
GET /good?cachekey=123
/good
在上游响应内容的一小段时间后,请求:
GET /bad?cachekey=123
位置请求是否应该/bad
等到/good
检索缓存并/bad
以 200 响应?如果没有,如何实现?