缓存池

属性
命名空间 fize\cache\handler\redis
类名 Pool
父类 fize\cache\AbstractPool
实现接口 Psr\Cache\CacheItemPoolInterface, fize\cache\PoolInterface
方法:
方法名 说明
__construct() 构造函数
getItem() 获取缓存项
clear() 清空缓存池
deleteItem() 从缓存池里移除缓存项
save() 立刻为对象做数据持久化
hasItem() 检查是否有对应的缓存项
getItems() 返回一个可供遍历的缓存项集合
deleteItems() 移除多个缓存项
saveItems() 设置多个缓存项
saveDeferred() 稍后为缓存项做数据持久化
commit() 提交所有的正在队列里等待的请求到数据持久层

方法

__construct()

构造函数

public function __construct (
    array $config = []
)
参数:
名称 说明
config 初始化默认选项

getItem()

获取缓存项

public function getItem (
    string $key
) : \Psr\Cache\CacheItemInterface
参数:
名称 说明
key 键名

clear()

清空缓存池

public function clear () : bool

deleteItem()

从缓存池里移除缓存项

public function deleteItem (
    string $key
) : bool
参数:
名称 说明
key 键名

save()

立刻为对象做数据持久化

public function save (
    \Psr\Cache\CacheItemInterface $item
) : bool
参数:
名称 说明
item 缓存对象

hasItem()

检查是否有对应的缓存项

public function hasItem (
    string $key
) : bool
参数:
名称 说明
key 键名

getItems()

返回一个可供遍历的缓存项集合

public function getItems (
    array $keys = []
) : \CacheItemInterface[]
参数:
名称 说明
keys 键名组成的数组

deleteItems()

移除多个缓存项

public function deleteItems (
    array $keys
) : bool
参数:
名称 说明
keys 键名组成的数组

saveItems()

设置多个缓存项

public function saveItems (
    \CacheItemInterface[] $items
) : bool
参数:
名称 说明
items  

saveDeferred()

稍后为缓存项做数据持久化

public function saveDeferred (
    \Psr\Cache\CacheItemInterface $item
) : bool
参数:
名称 说明
item  

commit()

提交所有的正在队列里等待的请求到数据持久层

public function commit () : bool