call a sub function and return

Poul-Henning Kamp phk at phk.freebsd.dk
Wed Oct 14 16:09:10 CEST 2009


In message <4AD5D327.9040108 at danielbruessler.de>, Daniel Bruessler writes:
>Hi!
>
>I'd like to call a sub function and use the return-function. But is
>there a return-function?
>
>#called from vcl_fetch: call vcl_custom_cachingtime;
>sub vcl_custom_cachingtimes {
>
>    if (req.url ~ "^/abc/*" {
>        set obj.ttl = 10m;
>        #return (0);
>    }
>
>    if (req.url ~ "^/def/*" {
>        set obj.ttl = 30s;
>    }
>
>}

It's not clear from you example what you would use the return for,
but you can simulate it, but putting you return value in a header
instead

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.



More information about the varnish-misc mailing list