sqlish queries for cache invalidation?

Alexandros Kechagias alexandros.kechagias at gmail.com
Tue Jan 30 16:06:44 UTC 2018


Hi there,
I have a question about your recommendation of banning caches with
obj.http.xkey.

I am also getting the following error from the compiler:
'obj.http.xkey': Not available in method 'vcl_recv'

Also according to the documentation [1] I can only access "obj.*"
inside vcl_hit[2] or vcl_deliver[3]
and I feel like this is the wrong place to use ban to ban objects.

I wanted to add this functionality into vcl_recv like:

    if (req.method == "BAN") {
        #  ACL purgers go here
        ban(obj.http.xkey ~ req.http.banrgx);
        return (synth(200, "Banned !"));
    }

Any suggestions?

I use varnish-cache 5.2.1

[1] variables in vcl subroutines :
https://book.varnish-software.com/4.0/chapters/VCL_Basics.html#variables-in-vcl-subroutines
[2] vcl_hit : https://book.varnish-software.com/4.0/chapters/VCL_Subroutines.html#vcl-vcl-hit
[3] vcl_deliver :
https://book.varnish-software.com/4.0/chapters/VCL_Subroutines.html#vcl-vcl-deliver

Thanks
Alexandros


More information about the varnish-misc mailing list