Purge object on POST or PUT

Martin Hewitt martin.hewitt at gmail.com
Mon Jun 18 17:18:54 CEST 2012


Hi all,

I'm looking at configuring Varnish to run infront of a CouchDB-based
database cluster. These two, sadly, don't work perfectly together, but
I'd like to know if it's possible to force a re-fetch of an object at
a given URL after a POST or PUT has been sent to said URL.

An example flow would be:

1. GET /database_name/ObjectId
- Object is fetched from the backend and placed in cache
2. GET /database_name/ObjectId
- Object is served from cache
3. POST /database_name/ObjectId
- I'm currently using pass; to send through all POST and PUT requests,
so the updated object now exists in the database
- Here is where I'd like to purge the object in the cache
4. GET /database_name/ObjectId
- Object is fetched from the backend and placed in cache
5. GET /database_name/ObjectId
- Object is served from cache

Currently, after the POST in [3], the subsequent GET passes the
original, now stale, object from the cache, as the headers don't
indicate that it should be updated. This header issue is why I'd like
to force a purge based on my knowledge of what the system will do,
instead of relying on the headers.

I'm using Varnish 3, but can switch if a different version would make
this doable!

Many thanks,

Martin



More information about the varnish-misc mailing list