I have zero experience with varnish. I want to setup varnish to do something very basic: I have two pages
http://mysite.com/
http://mysite.com/additem
I want to cache http://mysite.com/additem
for 10 minutes and http://mysite.com/
for 1 minute but whenever http://mysite.com/additem
is visited, I want to to clean the cache for http://mysite.com/
. Any help?
IIRC there's a cli program (purge) which you could call from http://mysite.com/additem, or use curl to send a purge instruction (as a HTTP verb) e.g.
But this presupposes you've got scripting at http://mysite.com/additem
I imagine it would be possible to call the purge in a VCL handler for http://mysite.com/additem
(not tested)
Part 1:
This command will clean (purge) a sub-folder (for example)
For your domain root, this will work*
*Note: Needs to be tested to see if the above purges sub-folders (recursive)
Part 2: Are you in charge of the server and not using it for (m)any other users? Do you allow system commands in PHP? If yes, it should be easy to run the command whenever http://mysite.com/additem is visited.
The above commands work from CLI, not tested yet the other way.