wpseek.com
WordPress开发者和主题制作者的搜索引擎



wp_cache_set › WordPress Function

Since2.0.0
已弃用n/a
wp_cache_set ( $key, $data, $group = '', $expire = 0 )
参数: (4)
  • (int|string) $key The cache key to use for retrieval later.
    Required: Yes
  • (mixed) $data The contents to store in the cache.
    Required: Yes
  • (string) $group Optional. Where to group the cache contents. Enables the same key to be used across groups. Default empty.
    Required: No
    默认: (empty)
  • (int) $expire Optional. When to expire the cache contents, in seconds. Default 0 (no expiration).
    Required: No
    默认:
查看:
  • WP_Object_Cache::set()
返回:
  • (bool) True on success, false on failure.
定义在:
文档:

Saves the data to the cache.

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


源码

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

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