{"id":18578,"date":"2020-02-03T14:34:19","date_gmt":"2020-02-03T19:34:19","guid":{"rendered":"https:\/\/www.boldgrid.com\/support\/?p=18578"},"modified":"2024-02-22T10:10:08","modified_gmt":"2024-02-22T15:10:08","slug":"purge-cache-log","status":"publish","type":"post","link":"https:\/\/www.boldgrid.com\/support\/w3-total-cache\/purge-cache-log\/","title":{"rendered":"How to use the Purge Cache Log in W3 Total Cache"},"content":{"rendered":"<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n<?xml encoding=\"utf-8\" ?><html><body><h1 class=\"wp-block-heading\" id=\"using-the-purge-cache-log-in-w3-total-cache\">Using the Purge Cache Log in W3 Total Cache<\/h1>\r\n\r\n\r\n\r\n<p>When you&rsquo;re troubleshooting your <a href=\"https:\/\/www.boldgrid.com\/w3-total-cache\/\">website&rsquo;s performance<\/a>, you need to be sure that your cache is only being purged when necessary. In order to avoid using server resources to rebuild your cache, it will be useful to know exactly what caused a cache purge. As of W3 Total Cache release 0.13.0, a new pro feature&mdash; Cache Purge Logs&mdash; makes this easier than ever before.<\/p>\r\n\r\n\r\n<div class=\"boldgrid-section\" style=\"margin-top: 60px;\">\r\n<div class=\"container w3tc-radius\" style=\"border-width: 0px; background-image: url('https:\/\/www.boldgrid.com\/wp-content\/uploads\/2023\/07\/upsell-darker-alt.png'); background-size: cover; background-position: 50% 5%;\" data-image-url=\"https:\/\/www.boldgrid.com\/wp-content\/uploads\/2023\/07\/upsell-darker-alt.png\">\r\n<div class=\"row upsell-column\" style=\"padding-top: 2em; padding-bottom: 2em; color: #ffffff;\">\r\n<div class=\"col-lg-1 col-md-1 col-sm-12 col-xs-12 hidden-sm\">&nbsp;<\/div>\r\n<div class=\"col-lg-5 col-md-6 col-xs-12 col-sm-7\">\r\n<p class=\"h3\" style=\"color: #ffffff; line-height: 40px; margin-top: 0;\"><strong>Speed Up Your WordPress Website.<\/strong><\/p>\r\n<p style=\"color: #ffffff;\" class=\"h4\">A Difference of Just 100ms in Page Load Speeds Can Cause a Visitor to Prefer Your Competitor&rsquo;s Website.<\/p>\r\n<\/div>\r\n<div class=\"col-lg-6 col-md-5 col-sm-5 col-xs-12 text-center align-column-center\">\r\n<p class=\"\" style=\"border-width: 0px;\"><a class=\"button-w3tc-white\" style=\"border: 2px solid #30BEC4; font-size: 18px; padding: 15px 30px;\" href=\"https:\/\/www.boldgrid.com\/w3-total-cache\/#pricing\">View Plans<\/a><\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id=\"background\">Background<\/h2>\r\n\r\n\r\n\r\n<p>W3 Total Cache uses &ldquo;triggers&rdquo; in WordPress, known as hooks, to cause an automatic purge of your cache when certain events occur. For example, if an author publishes a new post, an action is triggered in WordPress called wp_insert_post. W3 hooks into this function and adds the post to your Page Cache each time it&rsquo;s called.<\/p>\r\n\r\n\r\n\r\n<p>In that example, the cache purge&mdash; sometimes known as a cache <strong>flush<\/strong>&mdash; &nbsp;is warranted, so that the new post can be added to the Page Cache. Likewise, there are many times when your cache needs to be rebuilt. However, you may find that a plugin, theme, or another aspect of your website is triggering an automatic cache purge when you don&rsquo;t need it.<\/p>\r\n\r\n\r\n\r\n<p>Frequently rebuilding your cache can cause performance issues on your web or database server, and might even impact your CDN usage by exceeding data transfer limits. This is when you need to be able to determine what&rsquo;s causing cache purges.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id=\"enabling-cache-purge-logs-in-w3-total-cache\">Enabling Cache Purge Logs in W3 Total Cache<\/h2>\r\n\r\n\r\n\r\n<p>There are three cache purge logs available to pro users&mdash; the Page Cache, <a href=\"\/support\/w3-total-cache\/choosing-a-database-caching-method-in-w3-total-cache\/\">Database Cache<\/a>, and Object Cache.<\/p>\r\n\r\n\r\n\r\n<ol class=\"wp-block-list\">\r\n<li>Navigate to <strong>Performance -&gt; General Settings -&gt; Debug.<\/strong><\/li>\r\n\r\n\r\n\r\n<li>Check the box(es) for your desired log(s) and click <strong>Save all settings.<\/strong><\/li>\r\n\r\n\r\n\r\n<li>(Optional) If the checkbox is disabled, that cache type is not enabled in your settings. Visit the relevant section in <strong>General Settings<\/strong> and enable the cache type.<\/li>\r\n\r\n\r\n\r\n<li>Once an undesired cache purge event happens, click <strong>View log<\/strong> to examine the event.<a href=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/enable-cache-purge-log-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-18587 size-full\" src=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/enable-cache-purge-log-2.png\" alt=\"Enabling the purge logs on the General Settings screen\" width=\"1104\" height=\"698\" srcset=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/enable-cache-purge-log-2.png 1104w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/enable-cache-purge-log-2-300x190.png 300w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/enable-cache-purge-log-2-1024x647.png 1024w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/enable-cache-purge-log-2-768x486.png 768w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/enable-cache-purge-log-2-610x386.png 610w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/enable-cache-purge-log-2-250x158.png 250w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/enable-cache-purge-log-2-550x348.png 550w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/enable-cache-purge-log-2-800x506.png 800w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/enable-cache-purge-log-2-285x180.png 285w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/enable-cache-purge-log-2-474x300.png 474w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/enable-cache-purge-log-2-791x500.png 791w\" sizes=\"auto, (max-width: 1104px) 100vw, 1104px\" \/><\/a><\/li>\r\n<\/ol>\r\n\r\n\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id=\"interpreting-the-cache-purge-logs-reading-a-wordpress-stack-trace\">Interpreting the Cache Purge Logs&mdash; Reading a WordPress Stack Trace<\/h2>\r\n\r\n\r\n\r\n<p>Now that logging is enabled, you&rsquo;ll see that each purge event has a log including the timestamp of the event, the action that it performed, the user who triggered it, and the <strong>Stack Trace<\/strong> of the event.<\/p>\r\n\r\n\r\n\r\n<p>Reading a Stack Trace can seem intimidating at first because of the amount of information it contains, but using this information you can see the entire sequence of events that causes your cache to update. Here&rsquo;s an example of an administrator using the &ldquo;Purge Page Cache&rdquo; button from the WordPress Dashboard.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-all-page-cache-log.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-18583\" src=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-all-page-cache-log.png\" alt=\"Walking through a Stack Trace of an administrator clicking Purge Page Cache\" width=\"1029\" height=\"571\" srcset=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-all-page-cache-log.png 1029w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-all-page-cache-log-300x166.png 300w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-all-page-cache-log-1024x568.png 1024w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-all-page-cache-log-768x426.png 768w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-all-page-cache-log-610x338.png 610w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-all-page-cache-log-250x139.png 250w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-all-page-cache-log-550x305.png 550w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-all-page-cache-log-800x444.png 800w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-all-page-cache-log-324x180.png 324w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-all-page-cache-log-541x300.png 541w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-all-page-cache-log-901x500.png 901w\" sizes=\"auto, (max-width: 1029px) 100vw, 1029px\" \/><\/a><\/figure>\r\n\r\n\r\n\r\n<p>If you&rsquo;re accustomed to reading system logs, one of the big differences between a log and a stack trace is that the <strong>last event is the first in the log, and the first event appears last in the log.<\/strong> So in this instance, we can walk through exactly what the user did.<\/p>\r\n\r\n\r\n\r\n<ol class=\"wp-block-list\">\r\n<li>(#7 in the stack trace) The user was visiting the WordPress Dashboard&mdash; wp-admin\/admin.php<\/li>\r\n\r\n\r\n\r\n<li>(#5 in the stack trace) The user interacted with a control defined in the <strong>w3-total-cache<\/strong> plugin&rsquo;s &ldquo;Generic_Plugin_Admin.php&rdquo; file&mdash; specifically the &ldquo;w3tc_flush_posts&rdquo; control.<\/li>\r\n\r\n\r\n\r\n<li>(#1 in the stack trace) The plugin performed the action &ldquo;w3tc_flush_posts.&rdquo;<\/li>\r\n<\/ol>\r\n\r\n\r\n\r\n<p>Each step in a stack trace tells you precisely which line of code caused the next action in the stack trace.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id=\"thats-a-lot-of-information-how-do-i-spot-the-important-parts\">That&rsquo;s a lot of information, how do I spot the important parts?<\/h3>\r\n\r\n\r\n\r\n<p>As you can see in the screenshot, the plugin or theme that caused the flush is highlighted in bold text. For most WordPress site administrators, this is the biggest piece of information you need to diagnose the cause of unwanted cache flushes.<\/p>\r\n\r\n\r\n\r\n<p>Here&rsquo;s another example of a plugin causing a flush event:<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-caused-by-plugin.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-18584\" src=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-caused-by-plugin.png\" alt=\"A Stack Trace of a plugin causing a cache flush, with the plugin name highlighted in bold.\" width=\"1150\" height=\"833\" srcset=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-caused-by-plugin.png 1150w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-caused-by-plugin-300x217.png 300w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-caused-by-plugin-1024x742.png 1024w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-caused-by-plugin-768x556.png 768w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-caused-by-plugin-610x442.png 610w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-caused-by-plugin-250x181.png 250w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-caused-by-plugin-550x398.png 550w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-caused-by-plugin-800x579.png 800w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-caused-by-plugin-248x180.png 248w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-caused-by-plugin-414x300.png 414w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/02\/purge-caused-by-plugin-690x500.png 690w\" sizes=\"auto, (max-width: 1150px) 100vw, 1150px\" \/><\/a><\/figure>\r\n\r\n\r\n\r\n<p>In this example, the user is interacting with a plugin called <strong>fakerpress<\/strong>, which created a post using the <strong>wp_insert_post<\/strong> action. The action it eventually called was to flush the cache for a single post, with the Post ID 59.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id=\"resolving-cache-purge-issues\">Resolving Cache Purge Issues<\/h2>\r\n\r\n\r\n\r\n<p><\/p><p>Once you&rsquo;ve identified the User, Plugin, Theme, or event that&rsquo;s causing your cache to be purged unnecessarily, you can take steps to resolve or mitigate the issue. This may be as simple as disabling a plugin you don&rsquo;t need, or it might be as complicated as customizing your WordPress Cron schedule. If you need help resolving the issues you find in your Cache Purge Logs, <a href=\"https:\/\/w3edge.wufoo.com\/forms\/premium-services\/\">let us do the work for you with premium support.<\/a><\/p> <h2 id=\"the-actual-purge-log-files\">The Actual Purge Log Files<\/h2> <p>If you leave the purge logs running for an extended period of time, the log files themselves may grow quite large. When you&rsquo;re viewing the pure logs, at the top of the page you&rsquo;ll find both the full path to the log file and a button to clear the log file.<\/p>\r\n<\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>Using the Purge Cache Log in W3 Total Cache When you&rsquo;re troubleshooting your website&rsquo;s performance, you need to be sure that your cache is only being purged when necessary. In order to avoid using server resources to rebuild your cache, it will be useful to know exactly what caused a cache purge. As of W3 [&hellip;]<\/p>\n","protected":false},"author":1294,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"bgseo_title":"Using the Cache Purge Logs in W3 Total Cache","bgseo_description":"Use these instructions if you need to diagnose frequent or unneeded cache purges in your W3 Total Cache optimized WordPress website. The cache purge logs are a pro feature.","bgseo_robots_index":"index","bgseo_robots_follow":"follow","footnotes":""},"categories":[750,692],"tags":[699],"class_list":["post-18578","post","type-post","status-publish","format-standard","hentry","category-debugging","category-w3-total-cache","tag-purge-cache-log","feature-type-premium","experience-level-intermediate"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts\/18578","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/users\/1294"}],"replies":[{"embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/comments?post=18578"}],"version-history":[{"count":10,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts\/18578\/revisions"}],"predecessor-version":[{"id":125549,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts\/18578\/revisions\/125549"}],"wp:attachment":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/media?parent=18578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/categories?post=18578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/tags?post=18578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}