Setting default_ttl in vcl file

Ingvar Hagelund ingvar at linpro.no
Mon Oct 22 12:02:19 CEST 2007


This mail has stayed unanswered on varnish-dist, but I think someone on
varnish-misc may be able to answer.

Ingvar


Steve Scally <steve at kcilink.com> said on varnish-dist at projects.linpro.no
> Hello,
> 
> I have just started to use varnish and was looking into the default  
> cache time of an object / item, etc.  I know the default_ttl is 120  
> seconds and I was looking to change that to 3600 seconds.  From the  
> documentation and previous mail archives I have found three ways to  
> set this. Two ways are through the rc.d and rc.conf files and the  
> last is through the vcl.
> 
> A. /usr/local/etc/rc.d/varnishd file
> 
> Create a variable called varnishd_ttl and set it to 3600.
> : ${varnishd_ttl="3600"}
> 
> Edit varnishd_flags and add my new variable
> : ${varnishd_flags="-P ${pidfile} -a ${varnishd_listen} -f $ 
> {varnishd_config} -T ${varnishd_telnet} -s ${varnishd_storage} -t $ 
> {varnishd_ttl}"}
> 
> B. /etc/rc.conf
> 
> Create a variable called varnishd_ttl and set it to 3600.
> : ${varnishd_ttl="3600"}
> 
> Edit varnishd_flags and add my new variable
> 
> varnishd_enable="YES"
> varnishd_listen="mb-prv.kcilink.com:80"
> varnishd_storage="file,/var/tmp,512M"
> varnishd_config="/usr/local/etc/varnish/morebiz.vcl"
> varnishd_ttl="3600"
> varnishd_flags="-P ${pidfile} -a ${varnishd_listen} -f $ 
> {varnishd_config} -T ${varnishd_telnet} -s ${varnishd_storage} -t $ 
> {varnishd_ttl}"
> 
> c. /usr/local/etc/varnish/default.vcl
> 
> *if (obj.ttl < 3600s) {
> set obj.ttl = 3600s;
> }
> 
> *not exact just scratch code.
> 
> Now my question, is there a more direct way to change the default_ttl  
> either through configuration files or .vcl file?  If these are pretty  
> much the only three ways that is fine, I just wanted to make sure I  
> wasn't skipping over any options.  Thank you in advance for your help.
> 
> Steve




More information about the varnish-misc mailing list