\Fastknife\UtilsCacheUtils

Summary

Methods
Properties
Constants
__construct()
getCacheKey()
has()
get()
set()
inc()
dec()
delete()
clear()
clearTag()
No public properties found
No constants found
getRaw()
serialize()
unserialize()
$options
$readTimes
$writeTimes
N/A
unlink()
rmdir()
No private properties found
N/A

Properties

$options

$options : array

配置参数

Type

array

$readTimes

$readTimes : int

缓存读取次数

Type

int

$writeTimes

$writeTimes : int

缓存写入次数

Type

int

Methods

__construct()

__construct(array  $options = []) : mixed

架构函数

Parameters

array $options

参数

Returns

mixed —

getCacheKey()

getCacheKey(string  $name) : string

取得变量的存储文件名

Parameters

string $name

缓存变量名

Returns

string —

has()

has(string  $name) : bool

判断缓存是否存在

Parameters

string $name

缓存变量名

Returns

bool —

get()

get(string  $name, mixed  $default = null) : 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 —

delete()

delete(string  $name) : bool

删除缓存

Parameters

string $name

缓存变量名

Returns

bool —

clear()

clear() : bool

清除缓存

Returns

bool —

clearTag()

clearTag(array  $keys) : void

删除缓存标签

Parameters

array $keys

缓存标识列表

getRaw()

getRaw(string  $name) : array|null

获取缓存数据

Parameters

string $name

缓存标识名

Returns

array|null —

serialize()

serialize(mixed  $data) : string

序列化数据

Parameters

mixed $data

缓存数据

Returns

string —

unserialize()

unserialize(string  $data) : mixed

反序列化数据

Parameters

string $data

缓存数据

Returns

mixed —

unlink()

unlink(string  $path) : bool

判断文件是否存在后,删除

Parameters

string $path

Returns

bool —

rmdir()

rmdir( $dirname) : bool

删除文件夹

Parameters

$dirname

Returns

bool —