varnish v2.1: Where is "set obj.ttl" now allowed?

Jens Schleusener Jens.Schleusener at t-systems-sfr.com
Mon Mar 29 12:42:41 CEST 2010


Hi,

as a varnish newbie I tried a very simple accelerator configuration:

varnish v2.1 in front of a CMS backend that issues a "unnecessary"
restrictive non-caching policy via the HTTP header like

  Cache-Control: private, must-revalidate, max-age=0
  Vary: User-Agent

To hold data nevertheless one minute in the varnish cache I tried to use
the following kind of code (found similar in some examples and tutorials)

  sub vcl_fetch {
    if (obj.ttl < 60s) {
     set obj.ttl = 60s;
    }
  }

But starting varnishd I always get the error

  Message from VCC-compiler:
  Variable 'obj.ttl' not accessible in method 'vcl_fetch'.
  At: (input Line 7 Pos 10)
       if (obj.ttl < 60s) {
  ---------#######---------
  Running VCC-compiler failed, exit 1
  VCL compilation failed

http://varnish-cache.org/wiki/WikiStart#a2010-03-24Varnish2.1.0released
shows a short summary of changes and the hint "see the changelog for a 
fuller list". But I couldn't find an according changelog (the file
in the sources is "empty").

But I detected the fact that within the corresponding (?) testfile 
"bin/varnishtest/tests/v00016.vtc" the "obj.ttl" was changed to 
"beresp.ttl" (from v2.0.6 to v2.1). Is that possibly relevant to my 
problem?

So my question: In which method the mentioned functionality (forcing 
caching of an not-cachable object for a short meaningful time) must be 
configured in varnish v2.1?


And another currently not important question: Principally much of the 
backend pages are delivered in two versions (for user-agent IE and for 
user-agent Firefox incl. others). So an idea may be to have two specific 
varnish caches like

        /- varnish IE -\
  Apache                Backend CMS
        \- varnish FF -/

The Apache as "user-agent"-scheduler is just choosen since it could/should 
also do other tasks. Would that be meaningful or can varnish control that 
already itself?


And a small request: Some basic complete VCL examples would make the 
start in the varnish world much easier ;-)

Sorry, if my question are FAQs.

Regards

Jens




More information about the varnish-misc mailing list