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

Delete Cache by Group #2368

Closed
Closed
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
8a7dbb4
Added clearing of cache groups
pbearne Jan 4, 2022
bdca39b
Update src/wp-includes/cache.php
pbearne Jan 6, 2022
f87e341
removed full cache if group cache fails
pbearne Jan 7, 2022
a9b1db9
whitespace
pbearne Jan 7, 2022
576d82c
comments
pbearne Jan 7, 2022
21e6eac
refactor function and new test for new functions
pbearne Jan 10, 2022
f92ef14
dumped the function down
pbearne Jan 20, 2022
7abf5d6
removed not needed tests
pbearne Jan 20, 2022
ee6f101
removed not needed function
pbearne Feb 2, 2022
3d89efd
Merge branch 'trunk' into INITS-115-Support_flushing_cache_groups
pbearne Mar 1, 2022
baa5f32
Update src/wp-includes/cache.php
pbearne Mar 1, 2022
9305962
Update src/wp-includes/class-wp-object-cache.php
pbearne Mar 1, 2022
63730d5
Update src/wp-includes/class-wp-object-cache.php
pbearne Mar 1, 2022
a9a9e4d
Added fallback to cache-compat.php
pbearne Mar 1, 2022
ea41652
Merge remote-tracking branch 'origin/INITS-115-Support_flushing_cache…
pbearne Mar 1, 2022
095ab96
Added wp_cache_flush_group to get_pluggable_function_signatures test
pbearne Mar 1, 2022
8dcc405
Added array return if array is passed
pbearne Mar 1, 2022
a7bc773
removed not needed test wp_cache_get_linked_meta
pbearne Mar 2, 2022
670e754
removed whitespace changes
pbearne Mar 2, 2022
fb650ec
Update src/wp-includes/cache.php
pbearne Mar 8, 2022
2bcc284
Update src/wp-includes/cache.php
pbearne Mar 8, 2022
c65c89c
Update src/wp-includes/cache-compat.php
pbearne Mar 8, 2022
c03b962
Merge branch 'WordPress:trunk' into INITS-115-Support_flushing_cache_…
pbearne Mar 10, 2022
fcf0c8f
Update tests/phpunit/tests/cache.php
pbearne Mar 10, 2022
a65bc31
Update tests/phpunit/tests/cache.php
pbearne Mar 14, 2022
26fcbd8
Update tests/phpunit/tests/cache.php
pbearne Mar 15, 2022
7d715b7
Update src/wp-includes/cache-compat.php
pbearne Mar 21, 2022
3f26680
moved helper class to includes
pbearne Mar 21, 2022
b8c19b0
Merge branch 'WordPress:trunk' into INITS-115-Support_flushing_cache_…
pbearne Mar 24, 2022
e890990
removed method exists check
pbearne Mar 24, 2022
a0f699d
removed method exists check
pbearne Mar 24, 2022
47a5b5c
Merge branch 'WordPress:trunk' into INITS-115-Support_flushing_cache_…
pbearne Apr 5, 2022
d3ceb58
whitespaces
pbearne Apr 5, 2022
593dc79
added flush_group to memcache test code
pbearne Apr 5, 2022
4ecb1de
added flush_group to memcache test code
pbearne Apr 5, 2022
a26df6d
added check for method before calling
pbearne Apr 5, 2022
adac259
added check for method before calling
pbearne Apr 6, 2022
1829e23
Update src/wp-includes/cache.php
pbearne Apr 6, 2022
e76618b
Update src/wp-includes/cache.php
pbearne Apr 18, 2022
d5e7ed8
Update src/wp-includes/cache-compat.php
pbearne Apr 18, 2022
5e4433d
Update src/wp-includes/cache-compat.php
pbearne Apr 18, 2022
63228eb
Update src/wp-includes/cache.php
pbearne Apr 18, 2022
7f69e33
Update src/wp-includes/class-wp-object-cache.php
pbearne Apr 18, 2022
73fbd0b
added constant WP_OBJECT_CACHE_SUPPORTS_GROUP_FLUSH
pbearne Apr 19, 2022
156af11
Update src/wp-includes/cache.php
pbearne Apr 19, 2022
85d09da
Update src/wp-includes/cache-compat.php
pbearne Apr 19, 2022
f3f143a
Added WP_OBJECT_CACHE_SUPPORTS_GROUP_FLUSH to the memcache test cache…
pbearne Apr 19, 2022
3020e38
fixed whitespace
pbearne Apr 19, 2022
cd279c0
Update src/wp-includes/cache-compat.php
pbearne Apr 19, 2022
91a50b8
Update tests/phpunit/tests/cache.php
pbearne Apr 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/wp-includes/cache-compat.php
Expand Up @@ -141,3 +141,37 @@ function wp_cache_flush_runtime() {
return wp_using_ext_object_cache() ? false : wp_cache_flush();
}
endif;

if ( ! function_exists( 'wp_cache_flush_group' ) ) :
/**
* Removes all cache items in a group.
*
* @since 6.0.0
*
* @see WP_Object_Cache::flush_group()
* @global WP_Object_Cache $wp_object_cache Object cache global instance.
*
* @param string|array $group name(s) of group to remove from cache.
*
* @return bool|Array True or array of bool in array passed on success, false on failure group not found.
pbearne marked this conversation as resolved.
Show resolved Hide resolved
*/
function wp_cache_flush_group( $group ) {

global $wp_object_cache;
pbearne marked this conversation as resolved.
Show resolved Hide resolved

// if group is an array loop and call each key in the array

if ( is_array( $group ) ) {
$result = false;
$result[] = array_map( 'wp_cache_flush_group', array_values( $group ) );

return $result;
}

if ( method_exists( $wp_object_cache, 'flush_group' ) ) {
return $wp_object_cache->flush_group( $group );
}

return false;
pbearne marked this conversation as resolved.
Show resolved Hide resolved
}
endif;