2 locations, 2 _different_ cache valid settings, but same cache & pass-through
Francis Daly
francis at daoine.org
Fri Mar 27 08:21:55 UTC 2020
On Tue, Mar 24, 2020 at 11:15:59PM +0000, randyorbs wrote:
Hi there,
> 4. use _different_ cache valid settings...
> location /foo {
> proxy_pass "http://myhost.io/go";
> proxy_cache shared_cache;
> proxy_cache_valid any 5m;
> }
> location /bar {
> proxy_pass "http://myhost.io/go";
> proxy_cache shared_cache;
> proxy_cache_valid any 10m;
> }
>
> What I have found is that I can request /foo, then /bar and the /bar result will be an immediate HIT on the cache, which is good - the keys are the same and they are both aware of the cache. However, now that I've requested /bar any requests to /foo will result in cache HITs for 10 minutes instead of the 5 minutes I want. If I never hit /bar, then /foo will cache HIT for the correct 5 minutes.
>
> Any thoughts on how I can use NGINX to configure my way into a solution for my unusual (?) use-case?
The nginx cache file structure includes the validity period within the
stored object file.
The system does not care how the object file got there; it cares about
the file name and file contents.
So, "no".
(At least, not without writing your own special-case caching system.)
What is the thing that you want to achieve? Perhaps there is an alternate
way to get to the same desired end result.
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list