Varnishadm simple cache cleanup settings
Requirements:
1. Specify the url page cache to be cleared immediately
2. Specify the url list and clear it every 5 minutes.
Environment: ubuntu server 64-bit 13.04
For requirement 2, use shell. bash shell is used here.
Sudo vim/etc/crontab
Add a row
The varnish_clean.sh script is as follows:
For requirement 1, you can also directly use varnishadm in the command line. here we need to make a simple web interface for the program to automatically call.
Direct implementation using the simple web framework sinatra in ruby and ruby
For information about ruby and sinatra, Google or Bing
The sinatra section provides a simple web program. As long as you initiate a request, you can immediately clear the page with the specified number (set the id and page rules, or add the page to the file and leave it to the cron scheduled task for cleanup.
Sinatra may consider introducing some security measures, such as adding a security verification parameter. If it is not disclosed to the public network, it is just as simple as above.
Open the web application ruby varnish_tool.rb
Use curl to test curl-I localhost: 4567/update/cxxxxx/123