Cache keeps getting deleted
-
expire cache set to 0 ..but cache keeps getting deleted. Not sure why, I want it set to never expire.
-
Here’s an update for anyone having the same issue of Monarch plugin clearing Autoptimize / Cache Enabler cache. A reply from the Elegant Themes support:
Hello there, this is the intended behaviour. To disable it, you can go to Appearance -> Plugins > Editor -> Monarch -> /core/components/init.php and remove:
// Complimentary Performance Plugins // Autoptimize if ( is_callable( 'autoptimizeCache::clearall' ) ) { autoptimizeCache::clearall(); }
thanks for following up on this @martychc23! maybe ask them to make this an option or at least disable-able with a filter instead of having to change code?
I did ask why this is default behavior as it seems like a strange thing to do they said:
“Our developers took this decision because it was probably causing caching problems”
Looking in the code there is a whole host of other plugins it seems to clear cache for also:
// Cache Plugins // Comet Cache if ( is_callable( 'comet_cache::clear' ) ) { comet_cache::clear(); } // WP Rocket if ( function_exists( 'rocket_clean_post' ) ) { if ( '' !== $post_id ) { rocket_clean_post( $post_id ); } else if ( function_exists( 'rocket_clean_domain' ) ) { rocket_clean_domain(); } } // W3 Total Cache if ( has_action( 'w3tc_flush_post' ) ) { '' !== $post_id ? do_action( 'w3tc_flush_post', $post_id ) : do_action( 'w3tc_flush_posts' ); } // WP Super Cache if ( function_exists( 'wp_cache_debug' ) && defined( 'WPCACHEHOME' ) ) { include_once WPCACHEHOME . 'wp-cache-phase1.php'; include_once WPCACHEHOME . 'wp-cache-phase2.php'; if ( '' !== $post_id && function_exists( 'clear_post_supercache' ) ) { clear_post_supercache( $post_id ); } else if ( '' === $post_id && function_exists( 'wp_cache_clear_cache_on_menu' ) ) { wp_cache_clear_cache_on_menu(); } } // WP Fastest Cache if ( isset( $GLOBALS['wp_fastest_cache'] ) ) { if ( '' !== $post_id && method_exists( $GLOBALS['wp_fastest_cache'], 'singleDeleteCache' ) ) { $GLOBALS['wp_fastest_cache']->singleDeleteCache( $post_id ); } else if ( '' === $post_id && method_exists( $GLOBALS['wp_fastest_cache'], 'deleteCache' ) ) { $GLOBALS['wp_fastest_cache']->deleteCache(); } } // WordPress Cache Enabler if ( has_action( 'ce_clear_cache' ) ) { '' !== $post_id ? do_action( 'ce_clear_post_cache', $post_id ) : do_action( 'ce_clear_cache' ); } // LiteSpeed Cache if ( is_callable( 'LiteSpeed_Cache::get_instance' ) ) { $litespeed = LiteSpeed_Cache::get_instance(); if ( '' !== $post_id && method_exists( $litespeed, 'purge_post' ) ) { $litespeed->purge_post( $post_id ); } else if ( '' === $post_id && method_exists( $litespeed, 'purge_all' ) ) { $litespeed->purge_all(); } } // LiteSpeed Cache v1.1.3+ if ( '' !== $post_id && function_exists( 'litespeed_purge_single_post' ) ) { litespeed_purge_single_post( $post_id ); } else if ( '' === $post_id && is_callable( 'LiteSpeed_Cache_API::purge_all' ) ) { LiteSpeed_Cache_API::purge_all(); } // Hyper Cache if ( class_exists( 'HyperCache' ) && isset( HyperCache::$instance ) ) { if ( '' !== $post_id && method_exists( HyperCache::$instance, 'clean_post' ) ) { HyperCache::$instance->clean_post( $post_id ); } else if ( '' === $post_id && method_exists( HyperCache::$instance, 'clean' ) ) { HyperCache::$instance->clean_post( $post_id ); } } // Hosting Provider Caching // Pantheon Advanced Page Cache $pantheon_clear = 'pantheon_wp_clear_edge_keys'; $pantheon_clear_all = 'pantheon_wp_clear_edge_all'; if ( function_exists( $pantheon_clear ) || function_exists( $pantheon_clear_all ) ) { if ( '' !== $post_id && function_exists( $pantheon_clear ) ) { pantheon_wp_clear_edge_keys( array( "post-{$post_id}" ) ); } else if ( '' === $post_id && function_exists( $pantheon_clear_all ) ) { pantheon_wp_clear_edge_all(); } } // Siteground if ( isset( $GLOBALS['sg_cachepress_supercacher'] ) ) { global $sg_cachepress_supercacher; if ( is_object( $sg_cachepress_supercacher ) && method_exists( $sg_cachepress_supercacher, 'purge_cache' ) ) { $sg_cachepress_supercacher->purge_cache( true ); } } // WP Engine if ( class_exists( 'WpeCommon' ) ) { is_callable( 'WpeCommon::purge_memcached' ) ? WpeCommon::purge_memcached() : ''; is_callable( 'WpeCommon::clear_maxcdn_cache' ) ? WpeCommon::clear_maxcdn_cache() : ''; is_callable( 'WpeCommon::purge_varnish_cache' ) ? WpeCommon::purge_varnish_cache() : ''; if ( is_callable( 'WpeCommon::instance' ) && $instance = WpeCommon::instance() ) { method_exists( $instance, 'purge_object_cache' ) ? $instance->purge_object_cache() : ''; } } // Bluehost if ( class_exists( 'Endurance_Page_Cache' ) ) { wp_doing_ajax() ? ET_Core_LIB_BluehostCache::get_instance()->clear( $post_id ) : do_action( 'epc_purge' ); } // Complimentary Performance Plugins // Autoptimize if ( is_callable( 'autoptimizeCache::clearall' ) ) { autoptimizeCache::clearall(); }
Will suggest to them to make this optional!
and did they say under which circumstances monarch does all of that cache-clearing?
No, the support guy didn’t seem to know exactly why this is implemented. But it occurs whenever a post is published, a post is deleted, or when activating/deactivating plugins.
I suggested they make this optional so it’s easier for novices to make the change if desired, or use a filter as you suggested, and they said they will pass it on to developer.
- The topic ‘Cache keeps getting deleted’ is closed to new replies.