wordpress 函数:wp-云顶国际

如果 cache key 不存在,就添加数据到缓存中。

用法

参数

$key
(int|string) (required) cache key,用来以后获取缓存的数据
default: 无

$data
(mixed) (required) 要缓存的数据。
default: 无

$group
(string) (optional) 缓存添加到的组。
default: 'default'

$expire
(int) (optional) 要缓存的时间。
default: 0,如果内存缓存,0为永久的意思。

返回值

(bool)
如果 cache key 已经存在,返回 false,否则返回 true。

注解

  • 使用到 wp_object_cache 对象缓存的类
  • wp_object_cache::add()

修改记录

since 2.0.0

源文件

wp-includes/cache.php

         
网站地图