[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ -> cache-compat.php (summary)

Object Cache API functions missing from 3rd party object caches.

File Size: 314 lines (10 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 11 functions

  wp_cache_add_multiple()
  wp_cache_set_multiple()
  wp_cache_get_multiple()
  wp_cache_delete_multiple()
  wp_cache_flush_runtime()
  wp_cache_flush_group()
  wp_cache_supports()
  wp_cache_get_salted()
  wp_cache_set_salted()
  wp_cache_get_multiple_salted()
  wp_cache_set_multiple_salted()

Functions
Functions that are not part of a class:

wp_cache_add_multiple( array $data, $group = '', $expire = 0 )   X-Ref
Adds multiple values to the cache in one call, if the cache keys don't already exist.

Compat function to mimic wp_cache_add_multiple().

param: array  $data   Array of keys and values to be added.
param: string $group  Optional. Where the cache contents are grouped. Default empty.
param: int    $expire Optional. When to expire the cache contents, in seconds.
return: bool[] Array of return values, grouped by key. Each value is either

wp_cache_set_multiple( array $data, $group = '', $expire = 0 )   X-Ref
Sets multiple values to the cache in one call.

Differs from wp_cache_add_multiple() in that it will always write data.

Compat function to mimic wp_cache_set_multiple().

param: array  $data   Array of keys and values to be set.
param: string $group  Optional. Where the cache contents are grouped. Default empty.
param: int    $expire Optional. When to expire the cache contents, in seconds.
return: bool[] Array of return values, grouped by key. Each value is either

wp_cache_get_multiple( $keys, $group = '', $force = false )   X-Ref
Retrieves multiple values from the cache in one call.

Compat function to mimic wp_cache_get_multiple().

param: array  $keys  Array of keys under which the cache contents are stored.
param: string $group Optional. Where the cache contents are grouped. Default empty.
param: bool   $force Optional. Whether to force an update of the local cache
return: array Array of return values, grouped by key. Each value is either

wp_cache_delete_multiple( array $keys, $group = '' )   X-Ref
Deletes multiple values from the cache in one call.

Compat function to mimic wp_cache_delete_multiple().

param: array  $keys  Array of keys under which the cache to deleted.
param: string $group Optional. Where the cache contents are grouped. Default empty.
return: bool[] Array of return values, grouped by key. Each value is either

wp_cache_flush_runtime()   X-Ref
Removes all cache items from the in-memory runtime cache.

Compat function to mimic wp_cache_flush_runtime().

return: bool True on success, false on failure.

wp_cache_flush_group( $group )   X-Ref
Removes all cache items in a group, if the object cache implementation supports it.

Before calling this function, always check for group flushing support using the
`wp_cache_supports( 'flush_group' )` function.

param: string $group Name of group to remove from cache.
return: bool True if group was flushed, false otherwise.

wp_cache_supports( $feature )   X-Ref
Determines whether the object cache implementation supports a particular feature.

param: string $feature Name of the feature to check for. Possible values include:
return: bool True if the feature is supported, false otherwise.

wp_cache_get_salted( $cache_key, $group, $salt )   X-Ref
Retrieves cached data if valid and unchanged.

param: string          $cache_key The cache key used for storage and retrieval.
param: string          $group     The cache group used for organizing data.
param: string|string[] $salt      The timestamp (or multiple timestamps if an array) indicating when the cache group(s) were last updated.
return: mixed|false The cached data if valid, or false if the cache does not exist or is outdated.

wp_cache_set_salted( $cache_key, $data, $group, $salt, $expire = 0 )   X-Ref
Stores salted data in the cache.

param: string          $cache_key The cache key under which to store the data.
param: mixed           $data      The data to be cached.
param: string          $group     The cache group to which the data belongs.
param: string|string[] $salt      The timestamp (or multiple timestamps if an array) indicating when the cache group(s) were last updated.
param: int             $expire    Optional. When to expire the cache contents, in seconds.
return: bool True on success, false on failure.

wp_cache_get_multiple_salted( $cache_keys, $group, $salt )   X-Ref
Retrieves multiple items from the cache, only considering valid and unchanged items.

param: array           $cache_keys Array of cache keys to retrieve.
param: string          $group      The group of the cache to check.
param: string|string[] $salt       The timestamp (or multiple timestamps if an array) indicating when the cache group(s) were last updated.
return: array An associative array containing cache values. Values are `false` if they are not found or outdated.

wp_cache_set_multiple_salted( $data, $group, $salt, $expire = 0 )   X-Ref
Stores multiple pieces of salted data in the cache.

param: mixed           $data   Data to be stored in the cache for all keys.
param: string          $group  Group to which the cached data belongs.
param: string|string[] $salt   The timestamp (or multiple timestamps if an array) indicating when the cache group(s) were last updated.
param: int             $expire Optional. When to expire the cache contents, in seconds.
return: bool[] Array of return values, grouped by key. Each value is either



Generated : Thu Sep 4 08:20:02 2025 Cross-referenced by PHPXref