wp_cache_set() – Saves the data to the cache.

You appear to be a bot. Output may be restricted

Description

Saves the data to the cache.

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

Usage

$bool = wp_cache_set( $key, $data, $group, $expire );

Parameters

$key
( int|string ) required – The cache key to use for retrieval later.
$data
( mixed ) required – The contents to store in the cache.
$group
( string ) optional – Optional. Where to group the cache contents. Enables the same key to be used across groups. Default empty.
$expire
( int ) optional – Optional. When to expire the cache contents, in seconds. Default 0 (no expiration).

Returns

bool True on success, false on failure.

Source

File name: wordpress/wp-includes/cache.php
Lines:

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

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

 View on GitHub View on Trac