Varnishadm simple cache cleanup settings

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.