wp_cache_add() – Adds data to the cache, if the cache key doesn’t already exist.
You appear to be a bot. Output may be restricted
Description
Adds data to the cache, if the cache key doesn't already exist.
Usage
$bool = wp_cache_add( $key, $data, $group, $expire );
Parameters
- $key
- ( int|string ) required – The cache key to use for retrieval later.
- $data
- ( mixed ) required – The data to add to the cache.
- $group
- ( string ) optional – Optional. The group to add the cache to. Enables the same key to be used across groups. Default empty.
- $expire
- ( int ) optional – Optional. When the cache data should expire, in seconds. Default 0 (no expiration).
Returns
bool True on success, false if cache key and group already exist.
Source
File name: wordpress/wp-includes/cache.php
Lines:
1 to 5 of 5
function wp_cache_add( $key, $data, $group = '', $expire = 0 ) { global $wp_object_cache; return $wp_object_cache->add( $key, $data, $group, (int) $expire ); }