Property | Type | Description | |
---|---|---|---|
$blog_prefix | integer | The blog prefix to prepend to keys in non-global groups. | |
$cache | array | Holds the cached objects | |
$cache_hits | integer | The amount of times the cache data was already stored in the cache. | |
$cache_misses | integer | Amount of times the cache did not have the request in cache | |
$do_redis_failback_flush | boolean | Whether or not the object cache thinks Redis needs a flush | |
$global_groups | array | List of global groups | |
$is_redis_connected | boolean | Whether or not Redis is connected | |
$last_triggered_error | The last triggered error | ||
$non_persistent_groups | array | List of non-persistent groups | |
$redis_calls | integer | The amount of times a request was made to Redis | |
$redis_hash_groups | array | List of groups which use Redis hashes. |
Method | Description | |
---|---|---|
__construct ( ) : null | WP_Object_Cache | Sets up object properties; PHP 5 style constructor | |
__destruct ( ) : boolean | Will save the object cache before object is completely destroyed. | |
add ( integer | string $key, mixed $data, string $group = 'default', integer $expire ) : boolean | Adds data to the cache if it doesn't already exist. | |
add_global_groups ( array $groups ) | Sets the list of global groups. | |
add_non_persistent_groups ( array $groups ) | Sets the list of non-persistent groups. | |
add_redis_hash_groups ( array $groups ) | Sets the list of groups that use Redis hashes. | |
decr ( integer | string $key, integer $offset = 1, string $group = 'default' ) : false | integer | Decrement numeric cache item's value | |
delete ( integer | string $key, string $group = 'default', boolean $force = false ) : boolean | Remove the contents of the cache key in the group | |
delete_group ( string $group ) : boolean | Remove the contents of all cache keys in the group. | |
flush ( boolean $redis = true ) : boolean | Clears the object cache of all data. | |
get ( integer | string $key, string $group = 'default', string $force = false, boolean &$found = null ) : boolean | mixed | Retrieves the cache contents, if it exists | |
incr ( integer | string $key, integer $offset = 1, string $group = 'default' ) : false | integer | Increment numeric cache item's value | |
replace ( integer | string $key, mixed $data, string $group = 'default', integer $expire ) : boolean | Replace the contents in the cache, if contents already exist | |
reset ( ) | Reset keys | |
set ( integer | string $key, mixed $data, string $group = 'default', integer $expire ) : boolean | Sets the data contents into the cache | |
stats ( ) | Echoes the stats of the caching. | |
switch_to_blog ( integer $blog_id ) | Switch the interal blog id. | |
wp_action_admin_notices_warn_missing_redis ( ) | Admin UI to let the end user know something about the Redis connection isn't working. |
Method | Description | |
---|---|---|
_call_redis ( string $method ) : mixed | Wrapper method for calls to Redis, which fails gracefully when Redis is unavailable | |
_connect_redis ( ) | Wrapper method for connecting to Redis, which lets us retry the connection | |
_exists ( $key, $group ) | Utility function to determine whether a key exists in the cache. | |
_get_internal ( string $key, string $group ) : mixed | Get a value from the internal object cache | |
_isset_internal ( string $key, string $group ) : boolean | Check whether there's a value in the internal object cache. | |
_key ( string $key = '', string $group = 'default' ) : string | Utility function to generate the redis key for a given key and group. | |
_set_internal ( string $key, string $group, mixed $value ) | Set a value to the internal object cache | |
_should_persist ( string $group ) : boolean | Does this group use persistent storage? | |
_should_use_redis_hashes ( string $group ) : boolean | Should this group use Redis hashes? | |
_unset_internal ( string $key, string $group ) | Unset a value from the internal object cache |
Method | Description | |
---|---|---|
is_redis_failback_flush_enabled ( ) : boolean | Whether or not wakeup flush is enabled |
public __construct ( ) : null | WP_Object_Cache | ||
return | null | WP_Object_Cache | If cache is disabled, returns null. |
public __destruct ( ) : boolean | ||
return | boolean | True value. Won't be used by PHP |
protected _call_redis ( string $method ) : mixed | ||
$method | string | |
return | mixed |
protected _connect_redis ( ) |
protected _exists ( $key, $group ) |
protected _should_persist ( string $group ) : boolean | ||
$group | string | Cache group. |
return | boolean | true if the group is persistent, false if not. |
protected _should_use_redis_hashes ( string $group ) : boolean | ||
$group | string | Cache group. |
return | boolean | True if the group should use Redis hashes, false if not. |
protected _unset_internal ( string $key, string $group ) | ||
$key | string | |
$group | string |
public add ( integer | string $key, mixed $data, string $group = 'default', integer $expire ) : boolean | ||
$key | integer | string | What to call the contents in the cache |
$data | mixed | The contents to store in the cache |
$group | string | Where to group the cache contents |
$expire | integer | When to expire the cache contents |
return | boolean | False if cache key and group already exist, true on success |
public add_global_groups ( array $groups ) | ||
$groups | array | List of groups that are global. |
public add_non_persistent_groups ( array $groups ) | ||
$groups | array | List of groups that are non-persistent. |
public add_redis_hash_groups ( array $groups ) | ||
$groups | array | List of groups that use Redis hashes. |
public decr ( integer | string $key, integer $offset = 1, string $group = 'default' ) : false | integer | ||
$key | integer | string | The cache key to increment |
$offset | integer | The amount by which to decrement the item's value. Default is 1. |
$group | string | The group the key is in. |
return | false | integer | False on failure, the item's new value on success. |
public delete ( integer | string $key, string $group = 'default', boolean $force = false ) : boolean | ||
$key | integer | string | What the contents in the cache are called |
$group | string | Where the cache contents are grouped |
$force | boolean | Optional. Whether to force the unsetting of the cache key in the group |
return | boolean | False if the contents weren't deleted and true on success |
public delete_group ( string $group ) : boolean | ||
$group | string | Where the cache contents are grouped. |
return | boolean | True on success, false on failure. |
public get ( integer | string $key, string $group = 'default', string $force = false, boolean &$found = null ) : boolean | mixed | ||
$key | integer | string | What the contents in the cache are called |
$group | string | Where the cache contents are grouped |
$force | string | Whether to force a refetch rather than relying on the local cache (default is false) |
$found | boolean | Optional. Whether the key was found in the cache. Disambiguates a return of false, a storable value. Passed by reference. Default null. |
return | boolean | mixed | False on failure to retrieve contents or the cache contents on success |
public incr ( integer | string $key, integer $offset = 1, string $group = 'default' ) : false | integer | ||
$key | integer | string | The cache key to increment |
$offset | integer | The amount by which to increment the item's value. Default is 1. |
$group | string | The group the key is in. |
return | false | integer | False on failure, the item's new value on success. |
public replace ( integer | string $key, mixed $data, string $group = 'default', integer $expire ) : boolean | ||
$key | integer | string | What to call the contents in the cache |
$data | mixed | The contents to store in the cache |
$group | string | Where to group the cache contents |
$expire | integer | When to expire the cache contents |
return | boolean | False if not exists, true if contents were replaced |
public set ( integer | string $key, mixed $data, string $group = 'default', integer $expire ) : boolean | ||
$key | integer | string | What to call the contents in the cache |
$data | mixed | The contents to store in the cache |
$group | string | Where to group the cache contents |
$expire | integer | TTL for the data, in seconds |
return | boolean | Always returns true |
public stats ( ) |
public switch_to_blog ( integer $blog_id ) | ||
$blog_id | integer | Blog ID |
public wp_action_admin_notices_warn_missing_redis ( ) |
public int $blog_prefix | ||
return | integer |
public int $cache_hits | ||
return | integer |
public int $cache_misses | ||
return | integer |
public bool $do_redis_failback_flush | ||
return | boolean |
public bool $is_redis_connected | ||
return | boolean |
public array $non_persistent_groups | ||
return | array |
public int $redis_calls | ||
return | integer |
public array $redis_hash_groups | ||
return | array |