diff --git a/object-cache.php b/object-cache.php index f4bdda456ffd6098c923f5d8eeb2469d9e798d10..7571d96f2121dc810c8af11e192d808cda8ef155 100644 --- a/object-cache.php +++ b/object-cache.php @@ -934,18 +934,20 @@ class WP_Object_Cache { public function get( $key, $group = 'default', $server_key = '', $byKey = false ) { $derived_key = $this->build_key( $key, $group ); - if ( ! in_array( $group, $this->no_redis_groups ) ) { - $value = $this->redis->get( $this->restore_value_from_redis( $derived_key ) ); - } else { + if ( in_array( $group, $this->no_redis_groups ) ) { if ( isset( $this->cache[$derived_key] ) ) { return is_object( $this->cache[$derived_key] ) ? clone $this->cache[$derived_key] : $this->cache[$derived_key]; } elseif ( in_array( $group, $this->no_redis_groups ) ) { return false; - } else { - $value = $this->redis->get( $this->restore_value_from_redis( $derived_key ) ); } } + if ( $this->redis->exists( $derived_key ) ) { + $value = $this->restore_value_from_redis( $this->redis->get( $derived_key ) ); + } else { + return false; + } + $this->add_to_internal_cache( $derived_key, $value ); return is_object( $value ) ? clone $value : $value;