wp_cache_replace() - WordPress 函数参考中文文档

返回介绍

wp_cache_replace()

发布于 2017-09-11 字数1651 浏览 887 评论 0

wp_cache_replace( int|string $key,  mixed $data,  string $group = '',  int $expire )

Replaces the contents of the cache with new data.


描述


参数

$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)
(Optional)
The group for the cache data that should be replaced.

Default value: ”

$expire

(int)
(Optional)
When to expire the cache contents, in seconds. Default 0 (no expiration).


返回值

(bool) False if original value does not exist, true if contents were replaced


源代码

File: wp-includes/cache.php

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

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

更新日志

Version 描述
2.0.0 Introduced.

相关函数

Uses

  • wp-includes/cache.php:
    WP_Object_Cache::replace()

User Contributed Notes

上一篇:wp_cache_init()

下一篇:wp_cache_reset()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!