Nginx cache config:
proxy_cache_path /path/to/cache levels=1:2 keys_zone=my_cache:10m max_size=10g
inactive=60m use_temp_path=off;
server {
# ...
location / {
proxy_cache my_cache;
proxy_cache_valid 5m;
proxy_pass http://my_upstream;
}
}
inactive
inactive specifies how long an item can remain in the cache without being accessed. In this example, a file that has not been requested for 60 minutes is automatically deleted from the cache by the cache manager process, regardless of whether or not it has expired.
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.
Does proxy_cache_valid override inactive? 5m later does the cached file exist or not?