{"id":185526,"date":"2011-07-15T08:00:00","date_gmt":"2011-07-15T08:00:00","guid":{"rendered":"https:\/\/www.weixiaoduo.com\/plugins\/2024\/02\/22\/varnish-http-purge\/"},"modified":"2025-10-01T08:02:00","modified_gmt":"2025-10-01T08:02:00","slug":"varnish-http-purge","status":"publish","type":"post","link":"https:\/\/www.weixiaoduo.com\/plugins\/varnish-http-purge\/","title":{"rendered":"Proxy Cache Purge"},"content":{"rendered":"<p><strong>This plugin <em>does not<\/em> install nor configure a cache proxy. It acts as an interface with such services.<\/strong><\/p>\n<p>One common method of caching content for websites is via the use of reverse proxy caching. Common examples of this are <a href=\"https:\/\/www.varnish-cache.org\/\" rel=\"nofollow ugc\">Varnish<\/a> and <a href=\"https:\/\/www.nginx.com\/\" rel=\"nofollow ugc\">Nginx<\/a>. These systems allow a website to update content and have the visitor\u2019s experience cached without the need for complex plugins storing the files locally and using up a user\u2019s disk space.<\/p>\n<p>A reverse proxy cache is installed in front of a server and reviews requests. If the page being requested is already cached, it delivers the cached content. Otherwise it generates the page and the cache on demand.<\/p>\n<p>The Proxy Cache Purge plugin sends a request to delete (aka flush) the cached data of a page or post every time it\u2019s modified.<\/p>\n<h4>How It Works<\/h4>\n<p>When content on a site is updated by WordPress, the plugin reaches out to the proxy cache service with the URL of the page, requesting the cache be deleted.<\/p>\n<p>Not all page are deleted from the cache on every change. For example, when a post, page, or custom post type is edited, or a new comment is added, <em>only<\/em> the following pages will purge:<\/p>\n<ul>\n<li>The front page<\/li>\n<li>The post\/page edited<\/li>\n<li>Any categories, tags, and\/or custom taxonomies associated with the page<\/li>\n<li>Related feeds<\/li>\n<li>Associated JSON API pages<\/li>\n<\/ul>\n<p>In addition, your <em>entire<\/em> cache will be deleted on the following actions:<\/p>\n<ul>\n<li>Changing themes<\/li>\n<li>Pressing the <strong>Empty Cache<\/strong> button on the toolbar<\/li>\n<\/ul>\n<p>Plugins can hook into the purge actions as well, to filter their own events to trigger a purge.<\/p>\n<p>On a multisite network using subfolders, only <strong>network admins<\/strong> can purge the main site.<\/p>\n<h4>Development Mode<\/h4>\n<p>If you\u2019re working on a site and need to turn off caching in one of two ways:<\/p>\n<ol>\n<li>Add <code>define( 'VHP_DEVMODE', true );<\/code> to your <code>wp-config.php<\/code> file<\/li>\n<li>Go to Proxy Cache -> Settings and enable debug mode for 24 hours at a time<\/li>\n<\/ol>\n<p>That will break cache on page loads. It is <em>not<\/em> recommended for production!<\/p>\n<h4>WP CLI<\/h4>\n<p><strong>Purge<\/strong><\/p>\n<p>Purge commands let you empty the cache.<\/p>\n<ul>\n<li><code>wp varnish purge<\/code> \u2013 Flush the cache for your front page<\/li>\n<li><code>wp varnish purge [<url>]<\/code> \u2013 Flush the cache for one URL<\/li>\n<\/ul>\n<p>You can use the parameter <code>--wildcard<\/code> to empty everything from that URL down. So if you wanted to empty cache for all themes, you would do this:<\/p>\n<ul>\n<li><code>wp varnish purge https:\/\/example.com\/wp-content\/themes --wildcard<\/code><\/li>\n<\/ul>\n<p><strong>Debug<\/strong><\/p>\n<p>Debugging can help you figure out why your cache isn\u2019t working as well as it could. The default is for your home page, but you can pass any URL on your domain.<\/p>\n<ul>\n<li><code>wp varnish debug [<url>]<\/code><\/li>\n<\/ul>\n<p>Available parameters:<\/p>\n<ul>\n<li><code>[--include-headers]<\/code> \u2014  Include headers in debug check output<\/li>\n<li><code>[--include-grep]<\/code> \u2014 Grep active theme and plugin directories for common issues<\/li>\n<\/ul>\n<p><strong>DevMode<\/strong><\/p>\n<p>Development mode allows you to disable the cache, temporarily.<\/p>\n<ul>\n<li><code>wp varnish devmode [<activate|deactivate|toggle>]<\/code> \u2013 Change development mode state<\/li>\n<\/ul>\n<h4>Privacy Policy<\/h4>\n<p>As of version 5, this plugin no longer uses any remote data.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Automatically empty proxy cached content when your site is modified.<\/p>\n","protected":false},"author":65,"featured_media":364936,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"Proxy Cache Purge - \u8587\u6653\u6735\u63d2\u4ef6\u76ee\u5f55","description":"Automatically empty proxy cached content when your site is modified."},"footnotes":""},"categories":[1],"tags":[250,4112,8243,4210,13376],"class_list":["post-185526","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-cache","tag-nginx","tag-proxy","tag-purge","tag-varnish"],"_links":{"self":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/185526","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/comments?post=185526"}],"version-history":[{"count":0,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/185526\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media\/364936"}],"wp:attachment":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media?parent=185526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/categories?post=185526"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/tags?post=185526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}