Page Cache Self Purging
-
Hello,
We are using page cache and do not want it to purge. I have set all the purge policy off. Literally all settings are off, with only Purge Limit set to 1.
I am checking the page cache by looking in the server directories and can see the files get renamed to ****_old. I can also see the timestamp and there is nothing we are doing as admins that triggers this (eg. clear all cache from the menu)
Is wp-cron doing something that triggers complete emptying of page cache?FYI we are not using any browser cache either.
Many thanks
-
I’ve had a good look through the access_logs and the only thing that stands out is the following line:
“GET /wp-content/plugins/w3-total-cache/pub/css/feature-counter.css?ver=2.4.1 HTTP/2.0” 200 135 “https://dev.ourwebsite.co.uk/wp-admin/upload.php” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36”We have been adding images to the media library today.
Further to my initial message, i should clarify we are using browser cache but for HMTL files we have turned off
Set Expires Header
Set Cache Control Header
Set Entity TagHello @blkpudd
Thank you for reaching out and I am happy to assist you with this.
In some cases, some plugins or themes may use the W3 Total Cache filter to purge the cache once something is updated. W3 Total Cache does not purge the cache on its own unless specified in the Purge policy, which you mentioned is disabled.
This means that something is calling w3tc_flush_all(), and you can check this in the purge log which can be activated in Performance>General settings>Debug>Purge Logs:
I hope this helps!
Thanks!
Thank you for your speedy reply. I couldn’t see w3tc_flush_all in the purge log, just individual posts. Also there were not enough posts in the log compared to our entire site.
After much testing, it appears Saving a menu is causing the entire cache reset.
I imagine this is expected behaviour, but is there anyway to prevent it?Also found that deleting a Category will flush all posts.
We really only ever want to manually purge All posts, not have anything else interfere. Is that possible?
Hello @blkpudd
Thank you for your feedback. If the purge policy is disabled, it means that something else is calling the flush.
Can you pleas share the purge log?Thanks!
Hi Marko, the following snippet from the log is the last couple entries, but there were quite a few. This was following simply saving a menu.
[Wed, 13 Sep 2023 17:34:50 +0000] flush_post(197147)
username:Admin#0 wp-includes/class-wp-hook.php(310): W3TC\PgCache_Plugin--w3tc_flush_post (197147, null) #1 wp-content/plugins/w3-total-cache/CacheFlush_Locally.php(160): do_action ("w3tc_flush_post", 197147, null, null) #2 wp-content/plugins/w3-total-cache/Util_AttachToActions.php(116): W3TC\CacheFlush--flush_post (197147) #3 wp-includes/class-wp-hook.php(310): W3TC\Util_AttachToActions--on_post_change (197147, {"ID":197147,"post_author":"8","post_date":"2023-09-13 18:34:50","post_date_gmt":"2022-10-07 10:08..) #4 wp-includes/post.php(4717): do_action ("save_post", 197147, {"ID":197147,"post_author":"8","post_date":"2023-09-13 18:34:50","post_date_gmt":"2022-10-07 10:08.., true) #5 wp-includes/post.php(4819): wp_insert_post ({"post_author":"8","post_content":"We regularly update our showrooms with new displays and designs.., true, true) #6 wp-includes/nav-menu.php(589): wp_update_post ({"ID":197147,"post_author":"8","post_date":"2023-09-13 18:34:50","post_date_gmt":"2022-10-07 10:08.., true) #7 wp-admin/includes/nav-menu.php(1202): wp_update_nav_menu_item (37928, 197147, {"menu-item-db-id":"197147","menu-item-object-id":"4734","menu-item-object":"product_cat","menu-it..) #8 wp-admin/nav-menus.php(424): wp_nav_menu_update_menu_items (37928, "Mobile Menu")[Wed, 13 Sep 2023 17:34:50 +0000] flush_all
username:Admin
#0 wp-includes/class-wp-hook.php(308): W3TC\PgCache_Plugin–w3tc_flush_posts (null)
#1 wp-content/plugins/w3-total-cache/CacheFlush_Locally.php(170): do_action (“w3tc_flush_posts”, null)
#2 wp-content/plugins/w3-total-cache/Util_AttachToActions.php(153): W3TC\CacheFlush–flush_posts ()
#3 wp-includes/class-wp-hook.php(308): W3TC\Util_AttachToActions–on_change (37928)
#4 wp-admin/includes/nav-menu.php(1247): do_action (“wp_update_nav_menu”, 37928)
#5 wp-admin/nav-menus.php(424): wp_nav_menu_update_menu_items (37928, “Mobile Menu”)Hello @blkpudd
Thank you for your feedback.
Can you please clarify “saving the menu” action you performed?Thanks!
As mentioned there appears to be several actions that trigger this. Yes, saving a menu does it, editing a post (where content is used in other pages), deleting a category. We are using woo commerce, with several major plugins including Uber Menu and Superfly Menu.
As mentioned – saving a menu, this is one our nav menus accessed via Appearance > Menus – then hit save (even if there are no changes).
Hello @blkpudd
Thank you for your feedback.
As you can see, the functions in the mentioned W3TC files are triggered with the actions you have taken:
CacheFlush_Locally.php(170): do_action
function flush_posts( $extras = null ) {<br>$do_flush = apply_filters( 'w3tc_preflush_posts', true, $extras );<br>if ( $do_flush )<br>do_action( 'w3tc_flush_posts', $extras );and Util_AttachToActions–on_post_change
public function on_change() { $cacheflush = Dispatcher::component( 'CacheFlush' ); $cacheflush->flush_posts();I hope this clarifies the cache flush behavior.
Thanks!
-
This reply was modified 2 years, 8 months ago by
Marko Vasiljevic.
Hi Marko,
Is this W3TC design or is WP or a plugin triggering it?
I edited one post that is used as content in approx 60 products, but this triggered flushing all 2000 products and pages. Doesn’t seem the right approach if you ask me. If this is W3TC default behaviour then obviously there is little I can do about it.Grateful if you can confirm if this is W3TC design or not.
Many thanks
Hello @blkpudd
This depends on what you are updating.
If you update the menu, this naturally has an impact on all posts and pages since the menu shows on all pages/posts.
wp_nav_menu_update_menu_itemsAs for the latest purge, please share the purge log and the Purge policy screenshot.
Thanks!
I haven’t been able to recreate the post purge issue, so perhaps I did something else at the time. I had cleared the log so don’t have this morning’s record.
For category deletion and menu saves, I think the purging behaviour is as you say, expected and therefore part of W3TC code design, which is a shame as we would really like total control as to when things purge.
I will keep testing and let you know if there is anything else, thanks again.
-
This reply was modified 2 years, 8 months ago by
The topic ‘Page Cache Self Purging’ is closed to new replies.