On this page
wp_cache_replace( int|string $key, mixed $data, string $group = '', int $expire ): bool
Replaces the contents of the cache with new data.
Description
See also
Parameters
$keyint|string Required-
The key for the cache data that should be replaced.
$datamixed Required-
The new data to store in the cache.
$groupstring Optional-
The group for the cache data that should be replaced.
Default:
'' $expireint Optional-
When to expire the cache contents, in seconds.
Default 0 (no expiration).
Return
bool True if contents were replaced, false if original value does not exist.
Source
File: wp-includes/cache.php. View all references
function wp_cache_replace( $key, $data, $group = '', $expire = 0 ) {
global $wp_object_cache;
return $wp_object_cache->replace( $key, $data, $group, (int) $expire );
}
Related
Uses
| Uses | Description |
|---|---|
| WP_Object_Cache::replace() wp-includes/class-wp-object-cache.php | Replaces the contents in the cache, if contents already exist. |
Changelog
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_cache_replace