Cache API: Add helper function wp_cache_set_last_changed.

Add a helper function called `wp_cache_set_last_changed` to set the last changed value for cache groups. This function has a new action called `wp_cache_set_last_changed`, allowing for developers to cache invalidate when last changed value is changed. 

Props tillkruess, spacedmonkey, peterwilsoncc, mukesh27, johnjamesjacoby. 
Fixes #57905.

git-svn-id: https://develop.svn.wordpress.org/trunk@55702 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonny Harris
2023-05-02 11:24:52 +00:00
parent 9ef194bc4b
commit 73dbbe5372
7 changed files with 40 additions and 10 deletions

View File

@@ -5024,5 +5024,5 @@ function wp_register_persisted_preferences_meta() {
* @since 6.3.0
*/
function wp_cache_set_users_last_changed() {
wp_cache_set( 'last_changed', microtime(), 'users' );
wp_cache_set_last_changed( 'users' );
}