On Tue, Dec 3, 2019 at 6:04 PM al sefid <[email protected]> wrote: > > Hello there! > Is there any functionality like proxy_cache_min_uses in the Varnish cache > that caches a resource after specific number of requests to that resource? > Thank you!
Varnish is not capable of doing that by itself, but as Geoff pointed out on github you could rely on some form of throttling to emulate this functionality, but that requires a third-party module: https://github.com/varnishcache/varnish-cache/issues/3150#issuecomment-561307014 Be careful though, his example was a bit simplistic (I assume on purpose to show the idea) and shouldn't be used as-is. It might also not work if you have an object in your cache that outlives the throttling. Maybe the cat flap could work for this case, but here be dragons... I moved the discussion to the misc mailing list because this is not (yet?) dev material. While this may sound like a good idea, and while it works for nginx, it might not be a good fit for varnish. Of course unless we have that feature in place, it's also hard to tell whether this would benefit your workload, I suspect it would make things worse or force us to make other changes. In particular, making this a global configuration could be highly detrimental if you have some variety of contents in your cache (small, big, short- and long-lived etc) and the best place to start is to have the backend tell you precisely all about responses you may be able to cache or not and how instead of starting with an a priori criteria that a response shouldn't be cached unless it's asked at least 3 times (which is a very vague requirement). Dridi _______________________________________________ varnish-misc mailing list [email protected] https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
