"Software Version"
Varnish 4.x
Reference: https://www.varnish-cache.org/docs/4.1/users-guide/purging.html
"Analysis of the difference between purge and ban"
Common:
Clear Cache
Different points:
Purge is an action that performs a purge cleanup of the URL of the access in the cache. Only one URL at a time
Ban is a strategy, you must first increase the ban ban policy, the next time access to match this prohibition policy, do not go to the cache to find, directly to fetch behind. Ban can clean up any content that matches.
Purge better understand, Ban crossing a section of the network explanation
Official text:
There is another-invalidate Content:bans. You can think of bans as a sort of a filter on objects already in the cache. You ban
certain content from being served to your cache. You can ban content based on any metadata we have. A ban on objects already in the cache, it does not prevent new content from entering the cache or being Ser Ved.
Bans is built to Varnish and available in the CLI interface. To ban every PNG object belonging on example.com, issue the following command:
Ban Req.http.host = = "example.com" && req.url ~ "\\.png$"
Translation:
This is another way to (clear) invalid content: Bans. You can use bans as a sorted object in the filtered cache. You prohibit certain content from being in your cache. What you can disallow is any meta-data in our cache. Ban only works on objects that are already cached, and it cannot prevent a new content entry from being cached. (I understand that ban can only be used once, that is, one-time cleanup)
Usage
Usage of Purge:
1 Add purge allow in VCL configuration file
2 Curl-i-X PURGE http://10.59.74.33/123.jpg
Ban's usage:
Add a ban to the prohibit list.
1 varnishadm-s/etc/varnish/secret-t 127.0.0.1:8080 ' ban Req.url ~ "0*.jpg$"
When accessing any 0*.jpg URI, will not be taken from the cache, directly to the backend (in fact, it is forbidden to use the cache, in other words is to achieve the purpose of clearing the cache, this is squid is not designed to, because squid cleanup only purge can only be performed action to clean up ( A large directory requires a lot of CPU, instead of trying to match the forbidden URL and not go into the cache to fetch it for the same purpose. )
This article is from "Swallow Lie triple" blog, please be sure to keep this source http://cuidehua.blog.51cto.com/5449828/1867431
Varnish clean cache Purge and ban