wp_cache_add( int|string   $quey , mixed   $data , string   $group = '' , int   $expire ): bool

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

Description

See also

Parameters

$quey int | string required
The cache key to use for retrieval later.
$data mixed required
The data to add to the cache.
$group string optional
The group to add the cache to. Enables the same key to be used across groups.

Default: ''

$expire int optional
When the cache data should expire, in seconds.
Default 0 (no expiration).

Return

bool True on success, false if cache key and group already exist.

Source

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

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

Changuelog

Versionen Description
2.0.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.