Make WordPress Core


Ignore:
Timestamp:
07/22/2022 08:50:31 PM (21 months ago)
Author:
spacedmonkey
Message:

Cache API: Add wp_cache_flush_group function.

Add a new plugable function called wp_cache_flush_group, that will allow developers to clear whole cache groups with a single call. Developers can detect if their current implementation of an object cache supports flushing by group, by calling wp_cache_supports_group_flush which returns true if it is supported. If the developers of the object cache drop-in has not implemented wp_cache_flush_group and wp_cache_supports_group_flush, these functions are polyfilled and wp_cache_supports_group_flush defaults to false.

Props Spacedmonkey, filosofo, ryan, sc0ttkclark, SergeyBiryukov, scribu, Ste_95, dd32, dhilditch, dougal, lucasbustamante, dg12345, tillkruess, peterwilsoncc, flixos90, pbearne.
Fixes #4476.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/pluggable.php

    r53478 r53763  
    269269                    // wp-includes/cache.php:
    270270                    'wp_cache_init'                      => array(),
     271                    'wp_cache_supports_group_flush'      => array(),
    271272                    'wp_cache_add'                       => array(
    272273                        'key',
     
    328329                    'wp_cache_flush'                     => array(),
    329330                    'wp_cache_flush_runtime'             => array(),
     331                    'wp_cache_flush_group'               => array( 'group' ),
    330332                    'wp_cache_close'                     => array(),
    331333                    'wp_cache_add_global_groups'         => array( 'groups' ),
Note: See TracChangeset for help on using the changeset viewer.