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.
Built from https://develop.svn.wordpress.org/trunk@55702


git-svn-id: http://core.svn.wordpress.org/trunk@55214 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
spacedmonkey
2023-05-02 11:26:24 +00:00
parent 4bdeb57ac5
commit c1facaa4ce
8 changed files with 41 additions and 11 deletions

View File

@@ -96,7 +96,7 @@ function clean_network_cache( $ids ) {
do_action( 'clean_network_cache', $id );
}
wp_cache_set( 'last_changed', microtime(), 'networks' );
wp_cache_set_last_changed( 'networks' );
}
/**