Caching/Headers question
Rob Miller
rob at bigfish.co.uk
Wed Nov 23 19:37:43 CET 2011
On 23 Nov 2011, at 18:17, Jo Galara wrote:
> On 11/21/2011 07:11 PM, Hugo Cisneiros (Eitch) wrote:
>
>> Other way is to cache like forever and let the back-end notify varnish
>> to ban the object from the cache. It's a very efficient method for not
>> having varnish download the file from back-end unnecessarily :)
>
> How can I do that?
When faced with the same issue, I wrote a Ruby script that includes functionality for purging and refreshing an entire domain:
https://github.com/robmiller/Varnish-Toolkit
It supports things like purging a page along with all its external assets, purging a whole domain, and purging and then spidering a whole domain.
We often use it when we make a change to, say, the header or footer of a website that has a very slow backend (as some of our Magento ecommerce sites do); that way, our spider gets all of the slow requests and our end users get none.
Using this, we don't generally worry about TTLs; we cache everything for a really long time, then purge when we know we need to (either automatically, when a new piece of content goes live, or manually when we make a change to a stylesheet or template file).
You probably shouldn't use it unless you write lurker-friendly bans,[1] though.
Rob
[1]: http://kristianlyng.wordpress.com/2010/07/28/smart-bans-with-varnish/
--
Rob Miller
Big Fish® | 11 Chelsea Wharf | 15 Lots Road | London | SW10 0QJ
Office number: +44 (0)20 7795 0075
Direct dial: +44 (0)20 7376 6799
e-mail rob at bigfish.co.uk
http://www.bigfish.co.uk
If you're not a stalker, why not follow us on Twitter? @bigfishlondon
More information about the varnish-misc
mailing list