Skip to content

Commit 67e1eeb

Browse files
authored
Add wp_cache_get_pre filter
This will let us short-circuit the memcached request. The initial use-case here is to intercept hot keys to store them in a local apcu cache.
1 parent 9793b46 commit 67e1eeb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

object-cache.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ function wp_cache_flush() {
5555
function wp_cache_get( $key, $group = '', $force = false, &$found = null ) {
5656
global $wp_object_cache;
5757

58+
$value = apply_filters( 'wp_cache_get_pre', false, $key, $group, $force );
59+
if ( false !== $value ) {
60+
return $value
61+
}
62+
5863
return $wp_object_cache->get( $key, $group, $force, $found );
5964
}
6065

0 commit comments

Comments
 (0)