WordPress at a glance

wp_cache_replace() WP 1.0

Replaces the contents of the cache with new data.

  • See: WP_Object_Cache::replace()
  • Global. WP_Object_Cache. $wp_object_cache Object cache global instance.
✈ 1 time = 0.00012s = fast | 50000 times = 1.23s = fast

No Hooks.

Return

true/false. False if original value does not exist, true if contents were replaced

Usage

wp_cache_replace( $key, $data, $group, $expire );
$key(int/string) (required)
The key for the cache data that should be replaced.
$data(mixed) (required)
The new data to store in the cache.
$group(string)
The group for the cache data that should be replaced.
Default: ''
$expire(int)
When to expire the cache contents, in seconds.
Default: 0 (no expiration)

Code of wp_cache_replace: wp-includes/cache.php VER 5.0.1

<?php
function wp_cache_replace( $key, $data, $group = '', $expire = 0 ) {
	global $wp_object_cache;

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

Related Functions

From tag: cache (caching)

No comments
    Hello, !     Log In . Register