缓存池¶
属性 | 值 |
---|---|
命名空间 | fize\cache |
类名 | AbstractPool |
修饰符 | abstract |
实现接口 | fize\cache\PoolInterface, Psr\Cache\CacheItemPoolInterface |
方法: |
---|
方法名 | 说明 |
---|---|
__construct() | 构造 |
hasItem() | 检查是否有对应的缓存项 |
getItems() | 返回一个可供遍历的缓存项集合 |
deleteItems() | 移除多个缓存项 |
saveItems() | 设置多个缓存项 |
saveDeferred() | 稍后为缓存项做数据持久化 |
commit() | 提交所有的正在队列里等待的请求到数据持久层 |
getItem() | Returns a Cache Item representing the specified key. |
clear() | Deletes all items in the pool. |
deleteItem() | Removes the item from the pool. |
save() | Persists a cache item immediately. |
方法¶
getItems()¶
返回一个可供遍历的缓存项集合
public function getItems (
array $keys = []
) : \CacheItemInterface[]
参数: |
|
---|
saveItems()¶
设置多个缓存项
public function saveItems (
\CacheItemInterface[] $items
) : bool
参数: |
|
---|
saveDeferred()¶
稍后为缓存项做数据持久化
public function saveDeferred (
\Psr\Cache\CacheItemInterface $item
) : bool
参数: |
|
---|
getItem()¶
Returns a Cache Item representing the specified key.
abstract public function getItem (
string $key
) : \Psr\Cache\CacheItemInterface
参数: |
|
||||
---|---|---|---|---|---|
返回值: | The corresponding Cache Item. |
This method must always return a CacheItemInterface object, even in case of
a cache miss. It MUST NOT return null.
clear()¶
Deletes all items in the pool.
abstract public function clear () : bool
返回值: | True if the pool was successfully cleared. False if there was an error. |
---|
deleteItem()¶
Removes the item from the pool.
abstract public function deleteItem (
string $key
) : bool
参数: |
|
||||
---|---|---|---|---|---|
返回值: | True if the item was successfully removed. False if there was an error. |
save()¶
Persists a cache item immediately.
abstract public function save (
\Psr\Cache\CacheItemInterface $item
) : bool
参数: |
|
||||
---|---|---|---|---|---|
返回值: | True if the item was successfully persisted. False if there was an error. |