A WordPress-centric search engine for devs and theme authors



wp_cache_add ›

Since2.0.0
Deprecatedn/a
wp_cache_add ( $key, $data, $group = '', $expire = 0 )
Parameters: (4)
  • (int|string) $key The cache key to use for retrieval later.
    Required: Yes
  • (mixed) $data The data to add to the cache.
    Required: Yes
  • (string) $group Optional. The group to add the cache to. Enables the same key to be used across groups. Default empty.
    Required: No
    Default: (empty)
  • (int) $expire Optional. When the cache data should expire, in seconds. Default 0 (no expiration).
    Required: No
    Default:
See:
  • WP_Object_Cache::add()
Returns:
  • (bool) False if cache key and group already exist, true on success.
Defined at:
Codex:

Adds data to the cache, if the cache key doesn't already exist.



Source

function wp_cache_add( $key, $data, $group = '', $expire = 0 ) {
	global $wp_object_cache;

	return $wp_object_cache->add( $key, $data, $group, (int) $expire );
}