\think\cacheDriver

缓存基础类

Summary

Methods
Properties
Constants
has()
get()
set()
inc()
dec()
rm()
clear()
pull()
remember()
tag()
handler()
No public properties found
No constants found
getCacheKey()
setTagItem()
getTagItem()
$handler
$options
$tag
N/A
No private methods found
No private properties found
N/A

Properties

$handler

$handler

$options

$options

$tag

$tag

Methods

has()

has(string  $name) : bool

判断缓存是否存在

Parameters

string $name

缓存变量名

Returns

bool —

get()

get(string  $name, mixed  $default = false) : mixed

读取缓存

Parameters

string $name

缓存变量名

mixed $default

默认值

Returns

mixed —

set()

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

写入缓存

Parameters

string $name

缓存变量名

mixed $value

存储数据

int $expire

有效时间 0为永久

Returns

bool —

inc()

inc(string  $name, int  $step = 1) : false|int

自增缓存(针对数值缓存)

Parameters

string $name

缓存变量名

int $step

步长

Returns

false|int —

dec()

dec(string  $name, int  $step = 1) : false|int

自减缓存(针对数值缓存)

Parameters

string $name

缓存变量名

int $step

步长

Returns

false|int —

rm()

rm(string  $name) : bool

删除缓存

Parameters

string $name

缓存变量名

Returns

bool —

clear()

clear(string  $tag = null) : bool

清除缓存

Parameters

string $tag

标签名

Returns

bool —

pull()

pull(string  $name) : mixed

读取缓存并删除

Parameters

string $name

缓存变量名

Returns

mixed —

remember()

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

如果不存在则写入缓存

Parameters

string $name

缓存变量名

mixed $value

存储数据

int $expire

有效时间 0为永久

Returns

mixed —

tag()

tag(string  $name, string|array  $keys = null, bool  $overlay = false) : $this

缓存标签

Parameters

string $name

标签名

string|array $keys

缓存标识

bool $overlay

是否覆盖

Returns

$this —

handler()

handler() : object

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

Returns

object —

getCacheKey()

getCacheKey(string  $name) : string

获取实际的缓存标识

Parameters

string $name

缓存名

Returns

string —

setTagItem()

setTagItem(string  $name) : void

更新标签

Parameters

string $name

缓存标识

getTagItem()

getTagItem(string  $tag) : array

获取标签包含的缓存标识

Parameters

string $tag

缓存标签

Returns

array —