Opened 8 years ago
Last modified 8 years ago
#45417 new enhancement
Lack of actions when wp_cache_flush is called
| Reported by: | k1sul1 | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Cache API | Version: | |
| Severity: | trivial | Keywords: | needs-patch 2nd-opinion |
| Cc: | Focuses: |
Description
The function definition of wp_cache_flush doesn't have a do_action call, and neither does WP_Object_Cache->flush.
https://core.trac.wordpress.org/browser/tags/4.9.8/src/wp-includes/cache.php#L97
https://core.trac.wordpress.org/browser/tags/4.9.8/src/wp-includes/cache.php#L498
I want to be able to run additional code whenever the object cache is flushed but currently I can't.
Fixing this should be as trivial as adding
do_action('wp_cache_flush');
to the function definition of wp_cache_flush.
I don't care about the name of the action or if it runs before or after the flush, I'd just like to have this functionality in the core. Preferably before WordPress 6.0.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
A challenge with this is that if an object-cache dropin is used, then the core
wp-includes/cache.phpfile won't be loaded. Any hooks we decide to add would thus become impossible to rely upon.