"now" in VCL

Frank Gruellich frank.gruellich at mapsolute.com
Thu Aug 19 14:48:35 CEST 2010


Hi,

according to "man vcl" there is a variable "now":

   Variables
     [...]

     The following variables are always available:

     now   The current time, in seconds since the epoch.

However:

root at floor [~] $ cat foo.vcl
sub vcl_recv {
        if (now)
        {
                set req.backend = localhost;
        } else {
                set req.backend = localhost;
        }
}
root at floor [~] $ varnishd -C -f ./foo.vcl
Message from VCC-compiler:
Syntax error in condition, expected '(', '!' or variable name, found 'now'
(input Line 2 Pos 13)
        if (now)
------------###-
Running VCC-compiler failed, exit 1root at floor [~] $

Hm.  What am I doing wrong?  Or was it renamed?  Removed?

Thanks in advance.

Kind regards,
-- 
Navteq (DE) GmbH
Frank Gruellich
Map24 Systems and Networks

Duesseldorfer Strasse 40a
65760 Eschborn
Germany

Phone:      +49 6196 77756-414
Fax:        +49 6196 77756-100

HRB 46215, Local Court Frankfurt am Main
Managing Directors: Thomas Golob, Hans Pieter Gieszen, Martin Robert Stockman
USt-ID-No.: DE 197947163

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20100819/65cae858/attachment-0003.pgp>


More information about the varnish-misc mailing list