sqlish queries for cache invalidation?

Dridi Boukelmoune dridi at varni.sh
Tue Jan 23 17:04:27 UTC 2018

On Tue, Jan 23, 2018 at 5:12 PM, Alexandros Kechagias
<alexandros.kechagias at gmail.com> wrote:
> Hi Experts,
> I am looking for a way to invalidate a cache based on a set of different
> "keys" that can be combined with each other with operators like "AND", "OR"
> or "NOT".
> So I am looking for something that basically behaves like the xkey mod from
> varnish-modules[1] with the only difference that it can invalidate cache
> objects in an SQLish way.
> For example:
> xkey.NewPurge("userfoo OR projectbar AND NOT instancebaz")
> Do you know a way i could do that in varnish? I am capable of programming
> and writing VCL.


Not really an expert, but I'll share my two cents anyway.

I would recommend bans if it had all the boolean operations you are
looking for, but I think as of today only AND aka && is supported (and
NOT semantics by using negative operators like != or !~). You could
emulate an OR operator to some extent with regular|expressions but
that's limited to one header at a time.

That's the closest I'm aware of.


More information about the varnish-misc mailing list