proxy_cache_path 'inactive' vs http cache-control / expires headers?
roger at netskrt.io
Fri Apr 3 15:33:43 UTC 2020
> You can just set the inactive time longer than your possible maximum expire time for the objects then the cache manager won't purge the cache files even the object is still valid but not accessed.
That may only have a small impact.
As far as I understand:
NGINX will remove an item only when the cache is full (ie. it needs space for a new item).
Items are removed based on the least-recently used (LRU) queue.
The least-recently-used (last) item in the LRU queue is unconditionally removed.
The second and third last items are removed if they are past the invalid time.
The expiry of an item has no influence on the removal of items. It only affects if the item is delivered from the cache, or revalidated with an upstream request.
Restarting NGINX does have an impact. The LRU queue is not persisted (for performance reasons). On a restart, the LRU queue is based on the order that the cache loader finds the cached files in the file system.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the nginx