wp_cache_set() – Function | Developer.WordPress.org

Saves the data to the cache.

Description

Differs from wp_cache_add() and wp_cache_replace() in that it will always write data.

See also

Parameters

$keyint|stringrequired

The cache key to use for retrieval later.

$datamixedrequired

The contents to store in the cache.

$groupstringoptional

Where to group the cache contents. Enables the same key to be used across groups. Default empty.

$expireintoptional

When to expire the cache contents, in seconds.
Default 0 (no expiration).

Return

bool True on success, false on failure.

Source

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

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

View all references View on Trac View on GitHub

Changelog

VersionDescription
2.0.0Introduced.