wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_cache_set › WordPress Function

Since2.0.0
Deprecatedn/a
wp_cache_set ( $key, $data, $group = '', $expire = 0 )
Parameters: (4)
  • (int|string) $key The cache key to use for retrieval later.
    Required: Yes
  • (mixed) $data The contents to store in the cache.
    Required: Yes
  • (string) $group Optional. Where to group the cache contents. Enables the same key to be used across groups. Default empty.
    Required: No
    Default: (empty)
  • (int) $expire Optional. When to expire the cache contents, in seconds. Default 0 (no expiration).
    Required: No
    Default:
See:
  • WP_Object_Cache::set()
Returns:
  • (bool) True on success, false on failure.
Defined at:
Codex:

Saves the data to the cache.

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


Source

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

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