Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin invalidates entire cache with (W3 Total Cache) #18585

Open
2 tasks done
E1NSER opened this issue Jun 17, 2022 · 24 comments
Open
2 tasks done

Plugin invalidates entire cache with (W3 Total Cache) #18585

E1NSER opened this issue Jun 17, 2022 · 24 comments

Comments

@E1NSER
Copy link

E1NSER commented Jun 17, 2022

  • I've read and understood the contribution guidelines.
  • I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened.

As soon as a post is saved or updated, the complete cache is invalidated in connection with the plugin "W3 Total Cache".

/**
* Clears the WP or W3TC cache depending on which is used.
*
* @since 1.8.0
*/
public static function clear_cache() {
if ( function_exists( 'w3tc_pgcache_flush' ) ) {
w3tc_pgcache_flush();
}
elseif ( function_exists( 'wp_cache_clear_cache' ) ) {
wp_cache_clear_cache();
}
}

Please describe what you expected to happen and why.

Only the cache of the post that is currently being edited should be invalidated.

How can we reproduce this behavior?

  1. Install "W3 Total Cache" and "Yoast"
  2. Activate the "Page Cache"
  3. Create 2 or more posts
  4. Load the posts in the cache of "W3 Total Cache"
  5. Update one of the posts including data from the "Yoast Metabox"
  6. Save your changes
  7. Now you will see that every of the posts created earlier are invalidated and no longer cached

Used versions

  • WooCommerce version: 6.5.1
  • Yoast SEO version: 19.1
  • Yoast SEO Premium version: 18.7
  • W3 Total Cache version: 2.2.1
@E1NSER
Copy link
Author

E1NSER commented Jun 26, 2022

Any news?

@E1NSER
Copy link
Author

E1NSER commented Aug 8, 2022

@iamazik Any updates on this issue?

@mmikhan
Copy link
Member

mmikhan commented Aug 8, 2022

Apologize for the delay in getting back to you. Can you please confirm how you validated the cache after saving your changes on a post that all the caches were cleared? I want to ensure that I follow the same steps you did to reproduce the issue.

On the other hand, I found the relevant function clear_cache() is only being used in the following two places and that only invokes the function when updating options from the SEO options panel:

Lastly, when looking into the W3 Total Cache plugin's w3-total-cache-api.php file, I found the function w3tc_flush_posts() here we are using has also been deprecated, and a new is available:

Luckily, an additional function is available w3tc_flush_post( $post_id ) here to clear the cache on a specific page. Still, we first need to find out whether we are flushing the entire website's cache when updating a page.

@E1NSER
Copy link
Author

E1NSER commented Aug 9, 2022

Yes I can confirm that the whole cache gets invalidated if we change the SEO-Settings (YOAST Metabox) of a single product. If we just change the content or for example the price, only that specific post/products gets invalidated.

@mmikhan
Copy link
Member

mmikhan commented Aug 9, 2022

I am confused. The entire cache becomes invalidated to ensure that we both are on the same page when changing settings from the Yoast SEO global settings page (on the left navigation bar on the dashboard). When changing the content or price of a page or product, only that specific page/product cache becomes invalidated. Did I get that right? If so, what's the issue then?

@E1NSER
Copy link
Author

E1NSER commented Aug 9, 2022

No, not at all 😊

If you are on a single product/post in WooCommerce (/wp-admin/post.php?post=1234&action=edit) and editing the title or the content, everything is fine and just the post with the ID 1234 is invalidated but if you're editing some data in the MetaBox "Yoast SEO Premium" for this specific product with ID 1234 the cache for all other products and categories gets invalidated as well.

Bildschirmfoto 2022-08-09 um 15 40 14

Do you understand what I mean?

@mmikhan
Copy link
Member

mmikhan commented Aug 9, 2022

Thanks for explaining everything @E1NSER. In that case, can you please clarify how did you verify the cache status and whether the entire site cache was invalidated so that I can follow the same steps to reproduce the issue?

@E1NSER
Copy link
Author

E1NSER commented Aug 9, 2022

We're using a custom bash script to call every product/post url from a text file with cURL if the request takes longer than a few milliseconds the requested URL is not served from cache. We do this every 15 minutes to ensure that every url is in cache.

POC:
If an URL is not served from cache the request takes about 1 to 3 seconds per URL. If its served from cache it takes about 40ms per URL

#!/bin/bash
filename=/app/cache/files/$1

cd /themes/XYZ/
while read line; do
  time curl -A 'Cache Warmer' -s -L $line > /dev/null 2>&1
  echo $line
done < $filename

This method is much faster than the primer which comes directly via "W3 Total Cache" and works independently of the cache plugin used at a specific website.

@mmikhan
Copy link
Member

mmikhan commented Aug 9, 2022

Thanks for clarifying your test method. I tested the issue on our end using a typical method by revisiting pages while on incognito mode in the browser and could not reproduce the issue.

  1. I updated a post
  2. Visited a separate page (link copied) using Chrome's incognito mode
  3. Checked the page source code and can confirm that W3 Total Cache still serving the page from the disk cache

If you use the same method that I used, are you still able to reproduce the issue?

@E1NSER
Copy link
Author

E1NSER commented Aug 9, 2022

It only happens if you change data in the YOAST Metabox like the seo title (Appearance in Google) not if just change the content or the title of the product in WooCommerce.

If you like I could try to do a screen record to show you what I mean and the further process where you can see what happens afterwards.

@mmikhan
Copy link
Member

mmikhan commented Aug 9, 2022

That's right. I indeed changed the title using the Yoast SEO meta box but forgot to mention it in the last comment.

@E1NSER
Copy link
Author

E1NSER commented Aug 10, 2022

Just to be sure, you are also using the premium version of YOAST with the WooCommerce Extension?

@mmikhan
Copy link
Member

mmikhan commented Aug 10, 2022

No, I haven't used WooCommerce, nor WooCommerce SEO. It was a fresh WordPress installation with W3 Total Cache and Yoast SEO on it.

@mmikhan
Copy link
Member

mmikhan commented Aug 11, 2022

@E1NSER
Copy link
Author

E1NSER commented Aug 12, 2022

@iamazik Thank you for the link to the related topic. We will test this out in combination with "w3 total cache".

Do you have the possibility to check our topic in combination with the following Plugins?

  • WooCommerce
  • Yoast SEO
  • Yoast SEO Premium
  • Yoast SEO: WooCommerce

@KuddiCH
Copy link

KuddiCH commented Aug 12, 2022

Related: https://wordpress.org/support/topic/wp-super-cache-and-yoast-seo-incompatible/

We have tested it. It is not the same problem.

@E1NSER
Copy link
Author

E1NSER commented Aug 12, 2022

Related: https://wordpress.org/support/topic/wp-super-cache-and-yoast-seo-incompatible/

Wired issue but not related to this problem.

@KuddiCH
Copy link

KuddiCH commented Aug 17, 2022

@iamazik do you have any news?

@mmikhan
Copy link
Member

mmikhan commented Aug 22, 2022

Unfortunately, I am struggling to reproduce the issue on our end. I have used Yoast SEO, Yoast SEO Premium, Yoast WooCommerce SEO, and WooCommerce (the latest version of everything) and still couldn't reproduce the issue.

Once I activated W3 Total Cache, I enabled the Yoast SEO extension from the W3 Total Cache Extensions page, updated a post, checked a page, and can confirm the relevant page was still loading from the Disk cache (based on the output shown in the page source code.)

If any of you knows a better way to reproduce the issue, I am also open to that.

@StSaens
Copy link

StSaens commented Sep 27, 2023

I too noticed my full cache getting cleared. But not in a predictable manner. And I suspect this issue is very old, but it's hard to notice unless you have strict checking going on.
I'm latest wp, woo, w3tc (non premium) and yoast (non premium).

Background:
Every 5min. I retrieve an unused/unindexed page and check the headers if it's a fresh or cached page. When it finds the page is not cached it initiates a new cache build and notifies me. Cache build should only run at 08:01, 16:01, 00:01 or when I manually clear the entire cache from the wp backend.

I added a custom piece of code to w3tc's PgCache_Flush.php file. In public function flush() to be precise.
This custom code writes the output of wp_debug_backtrace_summary() to my logging file.

Et voila, when I receive the notification that my cache is not warm I see in my logging file the following:

2023-09-27 14:31:36 CEST page cache diepere functie gecalled door iets...
2023-09-27 14:31:36 CEST require_once('wp-admin/admin.php'), do_action('admin_init'), WP_Hook->do_action, WP_Hook->apply_filters, Yoast\WP\SEO\Integrations\Admin\Background_Indexing_Integration->register_shutdown_indexing, Yoast\WP\SEO\Integrations\Admin\Background_Indexing_Integration->should_index_on_shutdown, Yoast\WP\SEO\Helpers\Indexing_Helper->get_limited_filtered_unindexed_count_background, Yoast\WP\SEO\Helpers\Indexing_Helper->get_limited_unindexed_count, Yoast\WP\SEO\Actions\Indexing\Indexable_Post_Type_Archive_Indexation_Action->get_limited_unindexed_count, Yoast\WP\SEO\Actions\Indexing\Indexable_Post_Type_Archive_Indexation_Action->get_total_unindexed, do_action('wpseo_indexables_unindexed_calculated'), WP_Hook->do_action, WP_Hook->apply_filters, Yoast\WP\SEO\Analytics\User_Interface\Last_Completed_Indexation_Integration->maybe_set_indexables_unindexed_calculated, Yoast\WP\SEO\Helpers\Options_Helper->set, WPSEO_Options::set, WPSEO_Options::save_option, update_option, do_action('update_option_wpseo'), WP_Hook->do_action, WP_Hook->apply_filters, WPSEO_Utils::clear_cache, w3tc_pgcache_flush, w3tc_flush_posts, W3TC\CacheFlush->flush_posts, W3TC\CacheFlush_Locally->flush_posts, do_action('w3tc_flush_posts'), WP_Hook->do_action, WP_Hook->apply_filters, W3TC\PgCache_Plugin->w3tc_flush_posts, W3TC\PgCache_Flush->flush
2023-09-27 14:31:36 CEST page cache diepere functie gecalled door iets...
2023-09-27 14:31:36 CEST require_once('wp-admin/admin.php'), do_action('admin_init'), WP_Hook->do_action, WP_Hook->apply_filters, Yoast\WP\SEO\Integrations\Admin\Background_Indexing_Integration->register_shutdown_indexing, Yoast\WP\SEO\Integrations\Admin\Background_Indexing_Integration->should_index_on_shutdown, Yoast\WP\SEO\Helpers\Indexing_Helper->get_limited_filtered_unindexed_count_background, Yoast\WP\SEO\Helpers\Indexing_Helper->get_limited_unindexed_count, Yoast\WP\SEO\Actions\Indexing\Indexable_General_Indexation_Action->get_limited_unindexed_count, Yoast\WP\SEO\Actions\Indexing\Indexable_General_Indexation_Action->get_total_unindexed, do_action('wpseo_indexables_unindexed_calculated'), WP_Hook->do_action, WP_Hook->apply_filters, Yoast\WP\SEO\Analytics\User_Interface\Last_Completed_Indexation_Integration->maybe_set_indexables_unindexed_calculated, Yoast\WP\SEO\Helpers\Options_Helper->set, WPSEO_Options::set, WPSEO_Options::save_option, update_option, do_action('update_option_wpseo'), WP_Hook->do_action, WP_Hook->apply_filters, WPSEO_Utils::clear_cache, w3tc_pgcache_flush, w3tc_flush_posts, W3TC\CacheFlush->flush_posts, W3TC\CacheFlush_Locally->flush_posts, do_action('w3tc_flush_posts'), WP_Hook->do_action, WP_Hook->apply_filters, W3TC\PgCache_Plugin->w3tc_flush_posts, W3TC\PgCache_Flush->flush
2023-09-27 14:31:36 CEST page cache diepere functie gecalled door iets...
2023-09-27 14:31:36 CEST require_once('wp-admin/admin.php'), do_action('admin_init'), WP_Hook->do_action, WP_Hook->apply_filters, Yoast\WP\SEO\Integrations\Admin\Background_Indexing_Integration->register_shutdown_indexing, Yoast\WP\SEO\Integrations\Admin\Background_Indexing_Integration->should_index_on_shutdown, Yoast\WP\SEO\Helpers\Indexing_Helper->get_limited_filtered_unindexed_count_background, Yoast\WP\SEO\Helpers\Indexing_Helper->get_limited_unindexed_count, Yoast\WP\SEO\Actions\Indexing\Abstract_Link_Indexing_Action->get_limited_unindexed_count, Yoast\WP\SEO\Actions\Indexing\Abstract_Indexing_Action->get_total_unindexed, do_action('wpseo_indexables_unindexed_calculated'), WP_Hook->do_action, WP_Hook->apply_filters, Yoast\WP\SEO\Analytics\User_Interface\Last_Completed_Indexation_Integration->maybe_set_indexables_unindexed_calculated, Yoast\WP\SEO\Helpers\Options_Helper->set, WPSEO_Options::set, WPSEO_Options::save_option, update_option, do_action('update_option_wpseo'), WP_Hook->do_action, WP_Hook->apply_filters, WPSEO_Utils::clear_cache, w3tc_pgcache_flush, w3tc_flush_posts, W3TC\CacheFlush->flush_posts, W3TC\CacheFlush_Locally->flush_posts, do_action('w3tc_flush_posts'), WP_Hook->do_action, WP_Hook->apply_filters, W3TC\PgCache_Plugin->w3tc_flush_posts, W3TC\PgCache_Flush->flush
2023-09-27 14:31:37 CEST page cache diepere functie gecalled door iets...
2023-09-27 14:31:37 CEST require_once('wp-admin/admin.php'), do_action('admin_init'), WP_Hook->do_action, WP_Hook->apply_filters, Yoast\WP\SEO\Integrations\Admin\Background_Indexing_Integration->register_shutdown_indexing, Yoast\WP\SEO\Integrations\Admin\Background_Indexing_Integration->should_index_on_shutdown, Yoast\WP\SEO\Helpers\Indexing_Helper->get_limited_filtered_unindexed_count_background, Yoast\WP\SEO\Helpers\Indexing_Helper->get_limited_unindexed_count, Yoast\WP\SEO\Actions\Indexing\Abstract_Link_Indexing_Action->get_limited_unindexed_count, Yoast\WP\SEO\Actions\Indexing\Abstract_Indexing_Action->get_total_unindexed, do_action('wpseo_indexables_unindexed_calculated'), WP_Hook->do_action, WP_Hook->apply_filters, Yoast\WP\SEO\Analytics\User_Interface\Last_Completed_Indexation_Integration->maybe_set_indexables_unindexed_calculated, Yoast\WP\SEO\Helpers\Options_Helper->set, WPSEO_Options::set, WPSEO_Options::save_option, update_option, do_action('update_option_wpseo'), WP_Hook->do_action, WP_Hook->apply_filters, WPSEO_Utils::clear_cache, w3tc_pgcache_flush, w3tc_flush_posts, W3TC\CacheFlush->flush_posts, W3TC\CacheFlush_Locally->flush_posts, do_action('w3tc_flush_posts'), WP_Hook->do_action, WP_Hook->apply_filters, W3TC\PgCache_Plugin->w3tc_flush_posts, W3TC\PgCache_Flush->flush

Now how to reproduce. Sadly I do not know. There is at least one scenario which sometimes triggers this, which is just logging into the backend. And not doing anything else. But it cannot be predicted if a login will trigger this scenario.

@p-kehling
Copy link

p-kehling commented Jan 16, 2024

Hi, are there any updates on this? I think, I've same issue.

W3TC offers a "page cache purge log", I can see entries like this triggered by cron job:

[Wed, 17 Jan 2024 18:41:42 +0000] flush_all
        username:<admin-user>
        #0 wp-includes/class-wp-hook.php(324): 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/w3-total-cache-api.php(299): W3TC\CacheFlush--flush_posts (null)
        #3 wp-content/plugins/w3-total-cache/w3-total-cache-api.php(332): w3tc_flush_posts ()
        #4 wp-content/plugins/wordpress-seo/inc/class-wpseo-utils.php(418): w3tc_pgcache_flush ()
        #5 wp-includes/class-wp-hook.php(326): WPSEO_Utils--clear_cache ({"tracking":false,"toggled_tracking":false,"license_server_version":"false","ms_defaults_set":fals..)
        #6 wp-includes/option.php(883): do_action ("update_option_wpseo", {"tracking":false,"toggled_tracking":false,"license_server_version":"false","ms_defaults_set":fals.., {"tracking":false,"toggled_tracking":false,"license_server_version":"false","ms_defaults_set":fals.., "wpseo")
        #7 wp-content/plugins/wordpress-seo/inc/options/class-wpseo-options.php(507): update_option ("wpseo", {"tracking":false,"toggled_tracking":false,"license_server_version":"false","ms_defaults_set":fals..)
        #8 wp-content/plugins/wordpress-seo/inc/options/class-wpseo-options.php(311): WPSEO_Options--save_option ("wpseo", "last_known_no_unindexed", {"wpseo_total_unindexed_general_items":1705516902,"wpseo_unindexed_post_link_count":1705513084,"wp..)
        #9 wp-content/plugins/wordpress-seo/src/helpers/options-helper.php(37): WPSEO_Options--set ("last_known_no_unindexed", {"wpseo_total_unindexed_general_items":1705516902,"wpseo_unindexed_post_link_count":1705513084,"wp..)
        #10 wp-content/plugins/wordpress-seo/src/analytics/user-interface/last-completed-indexation-integration.php(61): Yoast\WP\SEO\Helpers\Options_Helper--set ("last_known_no_unindexed", {"wpseo_total_unindexed_general_items":1705516902,"wpseo_unindexed_post_link_count":1705513084,"wp..)
        #11 wp-includes/class-wp-hook.php(324): Yoast\WP\SEO\Analytics\User_Interface\Last_Completed_Indexation_Integration--maybe_set_indexables_unindexed_calculated ("wpseo_total_unindexed_general_items", 0)
        #12 wp-content/plugins/wordpress-seo/src/actions/indexing/indexable-general-indexation-action.php(56): do_action ("wpseo_indexables_unindexed_calculated", "wpseo_total_unindexed_general_items", 0)
        #13 wp-content/plugins/wordpress-seo/src/helpers/indexing-helper.php(259): Yoast\WP\SEO\Actions\Indexing\Indexable_General_Indexation_Action--get_total_unindexed ()
        #14 wp-content/plugins/wordpress-seo/src/helpers/indexing-helper.php(307): Yoast\WP\SEO\Helpers\Indexing_Helper--get_unindexed_count ()
        #15 wp-content/plugins/wordpress-seo/src/integrations/admin/indexing-tool-integration.php(149): Yoast\WP\SEO\Helpers\Indexing_Helper--get_filtered_unindexed_count ()
        #16 wp-includes/class-wp-hook.php(324): Yoast\WP\SEO\Integrations\Admin\Indexing_Tool_Integration--enqueue_scripts ("seo_page_wpseo_tools")
        #17 wp-admin/admin-header.php(118): do_action ("admin_enqueue_scripts", "seo_page_wpseo_tools")
        #18 wp-admin/admin.php(239): require_once ("/var/www/<folder>/wp-admin/admin-header.php")
[Wed, 17 Jan 2024 18:44:04 +0000] flush_all
        username:
        #0 wp-includes/class-wp-hook.php(324): 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/w3-total-cache-api.php(299): W3TC\CacheFlush--flush_posts (null)
        #3 wp-content/plugins/w3-total-cache/w3-total-cache-api.php(332): w3tc_flush_posts ()
        #4 wp-content/plugins/wordpress-seo/inc/class-wpseo-utils.php(418): w3tc_pgcache_flush ()
        #5 wp-includes/class-wp-hook.php(326): WPSEO_Utils--clear_cache ({"tracking":false,"toggled_tracking":false,"license_server
_version":"false","ms_defaults_set":fals..)
        #6 wp-includes/option.php(883): do_action ("update_option_wpseo", {"tracking":false,"toggled_tracking":false,"license_server_version":"false","ms_defaults_set":fals.., {"tracking":false,"toggled_tracking":false,"license_server_version":"false","ms_defaults_set":fals.., "wpseo")
        #7 wp-content/plugins/wordpress-seo/inc/options/class-wpseo-options.php(507): update_option ("wpseo", {"tracking":false,"toggled_tracking":false,"license_server_version":"false","ms_defaults_set":fals..)
        #8 wp-content/plugins/wordpress-seo/inc/options/class-wpseo-options.php(311): WPSEO_Options--save_option ("wpseo", "last_known_no_unindexed", {"wpseo_total_unindexed_general_items":1705517043,"wpseo_unindexed_post_link_count":1705517044,"wp..)
        #9 wp-content/plugins/wordpress-seo/src/helpers/options-helper.php(37): WPSEO_Options--set ("last_known_no_unindexed", {"wpseo_total_unindexed_general_items":1705517043,"wpseo_unindexed_post_link_count":1705517044,"wp..)
        #10 wp-content/plugins/wordpress-seo/src/analytics/user-interface/last-completed-indexation-integration.php(61): Yoast\WP\SEO\Helpers\Options_Helper--set ("last_known_no_unindexed", {"wpseo_total_unindexed_general_items":1705517043,"wpseo_unindexed_post_link_count":1705517044,"wp..)
        #11 wp-includes/class-wp-hook.php(324): Yoast\WP\SEO\Analytics\User_Interface\Last_Completed_Indexation_Integration--maybe_set_indexables_unindexed_calculated ("wpseo_unindexed_term_link_count", 0)
        #12 wp-content/plugins/wordpress-seo/src/actions/indexing/abstract-indexing-action.php(99): do_action ("wpseo_indexables_unindexed_calculated", "wpseo_unindexed_term_link_count", "0")
        #13 wp-content/plugins/wordpress-seo/src/actions/indexing/abstract-link-indexing-action.php(89): Yoast\WP\SEO\Actions\Indexing\Abstract_Indexing_Action--get_total_unindexed ()
        #14 wp-content/plugins/wordpress-seo/src/helpers/indexing-helper.php(333): Yoast\WP\SEO\Actions\Indexing\Abstract_Link_Indexing_Action--get_limited_unindexed_count (2)
        #15 wp-content/plugins/wordpress-seo/src/helpers/indexing-helper.php(375): Yoast\WP\SEO\Helpers\Indexing_Helper--get_limited_unindexed_count (1, [{},{},{},{},{},{}])
        #16 wp-content/plugins/wordpress-seo/src/integrations/admin/background-indexing-integration.php(326): Yoast\WP\SEO\Helpers\Indexing_Helper--get_limited_filtered_unindexed_count_background (1)
        #17 wp-content/plugins/wordpress-seo/src/integrations/admin/background-indexing-integration.php(209): Yoast\WP\SEO\Integrations\Admin\Background_Indexing_Integration--should_index_on_cron ()
        #18 wp-includes/class-wp-hook.php(324): Yoast\WP\SEO\Integrations\Admin\Background_Indexing_Integration--index ()
        #19 wp-includes/plugin.php(565): WP_Hook--do_action ([])
        #20 phar:https:///usr/local/bin/wp/vendor/wp-cli/cron-command/src/Cron_Event_Command.php(361): do_action_ref_array ("wpseo_indexable_index_batch", [])
        #21 phar:https:///usr/local/bin/wp/vendor/wp-cli/cron-command/src/Cron_Event_Command.php(284): Cron_Event_Command--run_event ({"hook":"wpseo_indexable_index_batch","time":1705516990,"sig":"40cd750bba9870f18aada2478b24840a","..)
        #22 (): Cron_Event_Command--run ([], {"due-now":true})
        #23 phar:https:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100): call_user_func ([{},"run"], [], {"due-now":true})
        #24 (): WP_CLI\Dispatcher\CommandFactory--WP_CLI\Dispatcher\{closure} ([], {"due-now":true})
        #25 phar:https:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(488): call_user_func ({}, [], {"due-now":true})
        #26 phar:https:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(436): WP_CLI\Dispatcher\Subcommand--invoke ([], {"due-now":true}, [])
        #27 phar:https:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(459): WP_CLI\Runner--run_command (["cron","event","run"], {"due-now":true})
        #28 phar:https:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1284): WP_CLI\Runner--run_command_and_exit ()
        #29 phar:https:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner--start ()
        #30 phar:https:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(83): WP_CLI\Bootstrap\LaunchRunner--process ({})
        #31 phar:https:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap ()
        #32 phar:https:///usr/local/bin/wp/php/boot-phar.php(20): include ("phar:https:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php")
        #33 /usr/local/bin/wp(4): include ("phar:https:///usr/local/bin/wp/php/boot-phar.php")

Why is cache flush called for option updates?

Currently my only workaround is to not change anything in seo menu (also not open it!) and disable cron indexing:
add_filter ( 'Yoast\WP\SEO\enable_cron_indexing', '__return_false' );

@mctwistyup
Copy link

mctwistyup commented Jun 5, 2024

Hello all,

I monitored the cache logs and i see that Yoast init a flush_all on the cache, each time we click on a Yoast menu or when a Yoast cron is started.

Please advice

the cache logs

[Wed, 05 Jun 2024 13:48:05 +0000] flush_all
        username:xxxxxxx
        #0 wp-includes/class-wp-hook.php(324): W3TC\PgCache_Plugin--w3tc_flush_posts (null)
        #1 wp-content/plugins/w3-total-cache/CacheFlush_Locally.php(167): do_action ("w3tc_flush_posts", null)
        #2 wp-content/plugins/w3-total-cache/w3-total-cache-api.php(303): W3TC\CacheFlush--flush_posts (null)
        #3 wp-content/plugins/w3-total-cache/w3-total-cache-api.php(336): w3tc_flush_posts ()
        #4 wp-content/plugins/wordpress-seo/inc/class-wpseo-utils.php(420): w3tc_pgcache_flush ()
        #5 wp-includes/class-wp-hook.php(326): WPSEO_Utils--clear_cache ({"tracking":false,"toggled_tracking":true,"license_server_version":"false","ms_defaults_set":false..)
        #6 wp-includes/option.php(889): do_action ("update_option_wpseo", {"tracking":false,"toggled_tracking":true,"license_server_version":"false","ms_defaults_set":false.., {"tracking":false,"toggled_tracking":true,"license_server_version":"false","ms_defaults_set":false.., "wpseo")
        #7 wp-content/plugins/wordpress-seo/inc/options/class-wpseo-options.php(515): update_option ("wpseo", {"tracking":false,"toggled_tracking":true,"license_server_version":"false","ms_defaults_set":false..)
        #8 wp-content/plugins/wordpress-seo/inc/options/class-wpseo-options.php(319): WPSEO_Options--save_option ("wpseo", "last_known_no_unindexed", {"wpseo_unindexed_post_link_count":1717582137,"wpseo_total_unindexed_post_type_archives":171759528..)
        #9 wp-content/plugins/wordpress-seo/src/helpers/options-helper.php(37): WPSEO_Options--set ("last_known_no_unindexed", {"wpseo_unindexed_post_link_count":1717582137,"wpseo_total_unindexed_post_type_archives":171759528..)
        #10 wp-content/plugins/wordpress-seo/src/analytics/user-interface/last-completed-indexation-integration.php(61): Yoast\WP\SEO\Helpers\Options_Helper--set ("last_known_no_unindexed", {"wpseo_unindexed_post_link_count":1717582137,"wpseo_total_unindexed_post_type_archives":171759528..)
        #11 wp-includes/class-wp-hook.php(324): Yoast\WP\SEO\Analytics\User_Interface\Last_Completed_Indexation_Integration--maybe_set_indexables_unindexed_calculated ("wpseo_total_unindexed_post_type_archives", 0)
        #12 wp-content/plugins/wordpress-seo/src/actions/indexing/indexable-post-type-archive-indexation-action.php(96): do_action ("wpseo_indexables_unindexed_calculated", "wpseo_total_unindexed_post_type_archives", 0)
        #13 wp-content/plugins/wordpress-seo/src/helpers/indexing-helper.php(265): Yoast\WP\SEO\Actions\Indexing\Indexable_Post_Type_Archive_Indexation_Action--get_total_unindexed ()
        #14 wp-content/plugins/wordpress-seo/src/helpers/indexing-helper.php(313): Yoast\WP\SEO\Helpers\Indexing_Helper--get_unindexed_count ()
        #15 wp-content/plugins/wordpress-seo/src/integrations/admin/first-time-configuration-integration.php(152): Yoast\WP\SEO\Helpers\Indexing_Helper--get_filtered_unindexed_count ()
        #16 wp-includes/class-wp-hook.php(324): Yoast\WP\SEO\Integrations\Admin\First_Time_Configuration_Integration--enqueue_assets ("toplevel_page_wpseo_dashboard")
        #17 wp-admin/admin-header.php(118): do_action ("admin_enqueue_scripts", "toplevel_page_wpseo_dashboard")
        #18 wp-admin/admin.php(239): require_once ("/var/www/html/wp-admin/admin-header.php")
[Wed, 05 Jun 2024 13:48:05 +0000] flush_all
        username:xxxxx
        #0 wp-includes/class-wp-hook.php(324): W3TC\PgCache_Plugin--w3tc_flush_posts (null)
        #1 wp-content/plugins/w3-total-cache/CacheFlush_Locally.php(167): do_action ("w3tc_flush_posts", null)
        #2 wp-content/plugins/w3-total-cache/w3-total-cache-api.php(303): W3TC\CacheFlush--flush_posts (null)
        #3 wp-content/plugins/w3-total-cache/w3-total-cache-api.php(336): w3tc_flush_posts ()
        #4 wp-content/plugins/wordpress-seo/inc/class-wpseo-utils.php(420): w3tc_pgcache_flush ()
        #5 wp-includes/class-wp-hook.php(326): WPSEO_Utils--clear_cache ({"tracking":false,"toggled_tracking":true,"license_server_version":"false","ms_defaults_set":false..)
        #6 wp-includes/option.php(889): do_action ("update_option_wpseo", {"tracking":false,"toggled_tracking":true,"license_server_version":"false","ms_defaults_set":false.., {"tracking":false,"toggled_tracking":true,"license_server_version":"false","ms_defaults_set":false.., "wpseo")
        #7 wp-content/plugins/wordpress-seo/inc/options/class-wpseo-options.php(515): update_option ("wpseo", {"tracking":false,"toggled_tracking":true,"license_server_version":"false","ms_defaults_set":false..)
        #8 wp-content/plugins/wordpress-seo/inc/options/class-wpseo-options.php(319): WPSEO_Options--save_option ("wpseo", "last_known_no_unindexed", {"wpseo_unindexed_post_link_count":1717582137,"wpseo_total_unindexed_post_type_archives":171759528..)
        #9 wp-content/plugins/wordpress-seo/src/helpers/options-helper.php(37): WPSEO_Options--set ("last_known_no_unindexed", {"wpseo_unindexed_post_link_count":1717582137,"wpseo_total_unindexed_post_type_archives":171759528..)
        #10 wp-content/plugins/wordpress-seo/src/analytics/user-interface/last-completed-indexation-integration.php(61): Yoast\WP\SEO\Helpers\Options_Helper--set ("last_known_no_unindexed", {"wpseo_unindexed_post_link_count":1717582137,"wpseo_total_unindexed_post_type_archives":171759528..)
        #11 wp-includes/class-wp-hook.php(324): Yoast\WP\SEO\Analytics\User_Interface\Last_Completed_Indexation_Integration--maybe_set_indexables_unindexed_calculated ("wpseo_total_unindexed_general_items", 0)
        #12 wp-content/plugins/wordpress-seo/src/actions/indexing/indexable-general-indexation-action.php(56): do_action ("wpseo_indexables_unindexed_calculated", "wpseo_total_unindexed_general_items", 0)
        #13 wp-content/plugins/wordpress-seo/src/helpers/indexing-helper.php(265): Yoast\WP\SEO\Actions\Indexing\Indexable_General_Indexation_Action--get_total_unindexed ()
        #14 wp-content/plugins/wordpress-seo/src/helpers/indexing-helper.php(313): Yoast\WP\SEO\Helpers\Indexing_Helper--get_unindexed_count ()
        #15 wp-content/plugins/wordpress-seo/src/integrations/admin/first-time-configuration-integration.php(152): Yoast\WP\SEO\Helpers\Indexing_Helper--get_filtered_unindexed_count ()
        #16 wp-includes/class-wp-hook.php(324): Yoast\WP\SEO\Integrations\Admin\First_Time_Configuration_Integration--enqueue_assets ("toplevel_page_wpseo_dashboard")
        #17 wp-admin/admin-header.php(118): do_action ("admin_enqueue_scripts", "toplevel_page_wpseo_dashboard")
        #18 wp-admin/admin.php(239): require_once ("/var/www/html/wp-admin/admin-header.php")

@josevarghese
Copy link
Contributor

Hi @mctwistyup

Thanks for sharing the cache log. We're now looking into this issue with our development team and will keep you posted.

@E1NSER
Copy link
Author

E1NSER commented Jun 6, 2024

Hi @mctwistyup

Thanks for sharing the cache log. We're now looking into this issue with our development team and will keep you posted.

Hopefully there will be a solution in the near future. We always have to implement our workaround after updating the plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants