1
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 响应?如果没有,如何实现?

4

0 回答 0