Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

proxy_cache_min_uses time window

Tags:

caching

nginx

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

like image 585
Gediminas Avatar asked Oct 16 '14 08:10

Gediminas


People also ask

What is Proxy_cache_bypass?

Defines conditions under which the response will not be taken from a cache.

What is Proxy_cache_valid?

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.

What is Proxy_cache_key?

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.

Should I enable NGINX caching?

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.


1 Answers

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).

like image 97
Cristian Greco Avatar answered Nov 22 '22 01:11

Cristian Greco