Make WordPress Core


Ignore:
Timestamp:
02/18/2022 12:04:52 PM (2 years ago)
Author:
spacedmonkey
Message:

Cache API: Add wp_cache_flush_runtime function

Add a new function called wp_cache_flush_runtime to existing caching functions found in WordPress. This function allows users to flush the runtime (in-memory) cache, without flushing the entire persistent cache.

Props: Spacedmonkey, tillkruess, flixos90, adamsilverstein, SergeyBiryukov, barryhughes.
Fixes: #55080.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/cache-compat.php

    r52708 r52772  
    124124    }
    125125endif;
     126
     127if ( ! function_exists( 'wp_cache_flush_runtime' ) ) :
     128    /**
     129     * Removes all cache items from the in-memory runtime cache.
     130     *
     131     * Compat function to mimic wp_cache_flush_runtime().
     132     *
     133     * @ignore
     134     * @since 6.0.0
     135     *
     136     * @see wp_cache_flush_runtime()
     137     *
     138     * @return bool True on success, false on failure.
     139     */
     140    function wp_cache_flush_runtime() {
     141        return wp_using_ext_object_cache() ? false : wp_cache_flush();
     142    }
     143endif;
Note: See TracChangeset for help on using the changeset viewer.