Make use of wp_cache_flush()

Sometimes, the answer is right in front of you.
This commit is contained in:
Tetrakern 2024-10-12 22:02:04 +02:00
parent e019391e72
commit 84e24a88eb
4 changed files with 15 additions and 22 deletions

View File

@ -13,8 +13,11 @@
*/
function fictioneer_watch_for_customizer_updates() {
// Transient caches
fictioneer_delete_layout_transients();
// Transients (fast)
fictioneer_delete_transients_like( 'fictioneer_', true );
// Object cache
wp_cache_flush();
// Rebuild customize stylesheet
fictioneer_build_customize_css();

View File

@ -169,7 +169,7 @@ if ( ! function_exists( 'fictioneer_purge_all_caches' ) ) {
*/
function fictioneer_purge_all_caches() {
// WordPress Query Cache
// Object cache
wp_cache_flush();
// Hook for additional purges
@ -795,20 +795,6 @@ if ( FICTIONEER_ENABLE_STORY_DATA_META_CACHE ) {
// PURGE CACHE TRANSIENTS
// =============================================================================
/**
* Purge layout-related Transients
*
* @since 5.25.0
*/
function fictioneer_delete_layout_transients() {
fictioneer_purge_nav_menu_transients();
fictioneer_purge_story_card_cache();
fictioneer_delete_transients_like( 'fictioneer_shortcode' );
fictioneer_delete_transients_like( 'fictioneer_taxonomy_submenu_' );
delete_transient( 'fictioneer_dynamic_scripts_version' );
}
/**
* Purge Transients used for caching when posts are updated
*

View File

@ -237,9 +237,12 @@ add_action( 'after_setup_theme', 'fictioneer_theme_setup' );
*/
function fictioneer_purge_caches_after_update() {
// Transients (fast, assuming this also causes a purge of external object caches)
// Transients (fast)
fictioneer_delete_transients_like( 'fictioneer_', true );
// Object cache
wp_cache_flush();
// Cache busting string
fictioneer_regenerate_cache_bust();

View File

@ -479,10 +479,11 @@ function fictioneer_purge_theme_caches() {
// Query result cache registry
delete_option( 'fictioneer_query_cache_registry' );
// Transients
fictioneer_delete_layout_transients();
fictioneer_delete_transients_like( 'fictioneer_shortcode' );
fictioneer_delete_transients_like( 'fictioneer_', true ); // Fast, but not safe for external object caches
// Transients (fast)
fictioneer_delete_transients_like( 'fictioneer_', true );
// Object cache
wp_cache_flush();
// Log
fictioneer_log( __( 'Purged theme caches.', 'fictioneer' ) );