wp_cache_replace

函数
wp_cache_replace ( $key, $data, $group = '', $expire = 0 )
参数
  • (int|string) $key The key for the cache data that should be replaced.
    Required:
  • (mixed) $data The new data to store in the cache.
    Required:
  • (string) $group Optional. The group for the cache data that should be replaced. Default empty.
    Required:
    Default: (empty)
  • (int) $expire Optional. When to expire the cache contents, in seconds. Default 0 (no expiration).
    Required:
返回值
  • (bool) True if contents were replaced, false if original value does not exist.
相关
  • WP_Object_Cache::replace()
定义位置
相关方法
wp_cache_resetwp_cache_deletewp_cache_decrwp_cache_closewp_cache_set
引入
2.0.0
弃用
-

wp_cache_replace函数用新的数据替换一个缓存项的内容。

用新的数据替换缓存的内容。

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

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

常见问题

FAQs
查看更多 >