Welcome! Log In Create A New Profile

Advanced

Re: proxy_cache_path 'inactive' vs http cache-control / expires headers?

April 03, 2020 11:26PM
Thanks, Maxim, for correcting my misunderstanding.

With what frequency is the cache manger run?

Roger

> On Apr 3, 2020, at 9:26 AM, Maxim Dounin <mdounin@mdounin.ru> wrote:
>
> Hello!
>
> On Fri, Apr 03, 2020 at 08:33:43AM -0700, Roger Fischer wrote:
>
>>> 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.
>
> Your understanding is wrong. Cache manager always removes all
> items which were not access for the "inactive=" period of time.
> Quoting docs (http://nginx.org/r/proxy_cache_path):
>
> : Cached data that are not accessed during the time specified by the
> : inactive parameter get removed from the cache regardless of their
> : freshness. By default, inactive is set to 10 minutes.
>
> See ngx_http_file_cache_expire() function for details.
>
> Additionally, cache items can be removed based on the "max_size="
> parameter of the "proxy_cache_path" directive, or if there isn't
> enough room in the "keys_zone=" shared memory zone.
>
>> 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.
>
> That's correct, as long as "expire" is meant to be the time from the
> Expires / X-Accel-Expires / Cache-Control / proxy_cache_valid. In
> nginx documentation this is called "caching time".
>
> --
> Maxim Dounin
> http://mdounin.ru/
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

proxy_cache_path 'inactive' vs http cache-control / expires headers?

J.R. April 02, 2020 12:32PM

RE: proxy_cache_path 'inactive' vs http cache-control / expires headers?

Reinis Rozitis April 02, 2020 01:02PM

Re: proxy_cache_path 'inactive' vs http cache-control / expires headers?

roger_bc April 03, 2020 11:34AM

Re: proxy_cache_path 'inactive' vs http cache-control / expires headers?

Maxim Dounin April 03, 2020 12:28PM

Re: proxy_cache_path 'inactive' vs http cache-control / expires headers?

roger_bc April 03, 2020 11:26PM

Re: proxy_cache_path 'inactive' vs http cache-control / expires headers?

Maxim Dounin April 05, 2020 08:12AM

Re: proxy_cache_path 'inactive' vs http cache-control / expires headers?

J.R. April 02, 2020 01:44PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 222
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready