简易缓存¶
遵循 PSR16 规范,使用静态方法调用
属性 | 值 |
---|---|
命名空间 | fize\cache |
类名 | Cache |
方法: |
---|
方法名 | 说明 |
---|---|
__construct() | 常规调用请先初始化 |
getInstance() | 取得实例 |
get() | 获取一个缓存 |
set() | 设置一个缓存 |
delete() | 删除一个缓存 |
clear() | 清空所有缓存 |
getMultiple() | 获取多个缓存 |
setMultiple() | 设置多个缓存 |
deleteMultiple() | 删除多个缓存 |
has() | 判断缓存是否存在 |
方法¶
__construct()¶
常规调用请先初始化
public function __construct (
string $handler,
array $config = []
)
参数: |
|
---|
getInstance()¶
取得实例
public static function getInstance (
string $handler,
array $config = []
) : \fize\cache\CacheInterface
参数: |
|
---|
get()¶
获取一个缓存
public static function get (
string $key,
mixed $default = null
) : mixed
参数: |
|
---|
set()¶
设置一个缓存
public static function set (
string $key,
mixed $value,
\DateInterval|int|null $ttl = null
) : bool
参数: |
|
---|
getMultiple()¶
获取多个缓存
public static function getMultiple (
iterable $keys,
mixed $default = null
) : iterable
参数: |
|
---|
setMultiple()¶
设置多个缓存
public static function setMultiple (
iterable $values,
\DateInterval|int|null $ttl = null
) : bool
参数: |
|
---|
deleteMultiple()¶
删除多个缓存
public static function deleteMultiple (
iterable $keys
) : bool
参数: |
|
---|