nginx proxy has a directive proxy_cache_min_uses
but I can't find what's the time window used or how to set one. Because if it doesn't use any time window and just waits for the requests to reach some counter then eventually all requests will do, if you keep nginx running for long enough.
Or a relatively rare request would be quickly evicted from the cache because of least recently used policy and I shouldn't be too concerned about that?
Thanks
Defines conditions under which the response will not be taken from a cache.
proxy_cache_valid. Sets caching time for different response codes. If only caching time is specified then only 200, 301, and 302 responses are cached.
The proxy_cache_key directive configures the string to be hashed for the cache key. The proxy_cache_key can be set in the context of HTTP, server, and location blocks, providing flexible control on how requests are cached.
Enabling nginx caching is recommended only for websites with a specific profile (for example, popular blogs or news websites): High traffic. The content is updated every few seconds.
proxy_cache_min_uses
just counts the number of requests after which the response from upstream will be cached.
Requests are evicted from cache when they are not accessed within an expiration time or when the size of the cache exceeds a max value (using LRU algorithm). You can tune the proxy cache via the proxy_cache_path directive (here a nice doc with examples).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With