Properties

$handler

$handler : object

驱动句柄

Type

object

$readTimes

$readTimes : int

缓存读取次数

Type

int

$writeTimes

$writeTimes : int

缓存写入次数

Type

int

$options

$options : array

缓存参数

Type

array

$tag

$tag : array

缓存标签

Type

array

Methods

getCacheKey()

getCacheKey(string  $name) : string

获取实际的缓存标识

Parameters

string $name

缓存名

Returns

string —

pull()

pull(string  $name) : mixed

读取缓存并删除

Parameters

string $name

缓存变量名

Returns

mixed —

push()

push(string  $name, mixed  $value) : void

追加(数组)缓存

Parameters

string $name

缓存变量名

mixed $value

存储数据

append()

append(string  $name, mixed  $value) : void

追加TagSet数据

Parameters

string $name

缓存变量名

mixed $value

存储数据

remember()

remember(string  $name, mixed  $value, int  $expire = null) : mixed

如果不存在则写入缓存

Parameters

string $name

缓存变量名

mixed $value

存储数据

int $expire

有效时间 0为永久

Returns

mixed —

tag()

tag(string|array  $name) : \think\cache\TagSet

缓存标签

Parameters

string|array $name

标签名

Returns

\think\cache\TagSet —

getTagItems()

getTagItems(string  $tag) : array

获取标签包含的缓存标识

Parameters

string $tag

标签标识

Returns

array —

getTagKey()

getTagKey(string  $tag) : string

获取实际标签名

Parameters

string $tag

标签名

Returns

string —

handler()

handler() : object

返回句柄对象,可执行其它高级方法

Returns

object —

getReadTimes()

getReadTimes() : int

返回缓存读取次数

Returns

int —

getWriteTimes()

getWriteTimes() : int

返回缓存写入次数

Returns

int —

getMultiple()

getMultiple(iterable  $keys, mixed  $default = null) : iterable

读取缓存

Parameters

iterable $keys

缓存变量名

mixed $default

默认值

Throws

\think\exception\InvalidArgumentException

Returns

iterable —

setMultiple()

setMultiple(iterable  $values, null|int|\DateInterval  $ttl = null) : bool

写入缓存

Parameters

iterable $values

缓存数据

null|int|\DateInterval $ttl

有效时间 0为永久

Returns

bool —

deleteMultiple()

deleteMultiple(iterable  $keys) : bool

删除缓存

Parameters

iterable $keys

缓存变量名

Throws

\think\exception\InvalidArgumentException

Returns

bool —

__call()

__call(mixed  $method, mixed  $args) : mixed

Parameters

mixed $method
mixed $args

Returns

mixed —

getExpireTime()

getExpireTime(int|\DateTimeInterface|\DateInterval  $expire) : int

获取有效期

Parameters

int|\DateTimeInterface|\DateInterval $expire

有效期

Returns

int —

serialize()

serialize(mixed  $data) : string

序列化数据

Parameters

mixed $data

缓存数据

Returns

string —

unserialize()

unserialize(string  $data) : mixed

反序列化数据

Parameters

string $data

缓存数据

Returns

mixed —