adinan-cenci/file-cache
最新稳定版本:2.0.1
Composer 安装命令:
composer require adinan-cenci/file-cache
包简介
A PSR-16 implementation around the PHP Filesystem.
README 文档
README
This is a PSR-16 implementation build around the php Filesystem.
How to use it
Once instantiated, use like specified in the PSR-16
use AdinanCenci\FileCache\Cache; $cache = new Cache('my-cache-directory/');
Caching
Inform an unique identifier for the data you desire to cache. Optionally you may inform its time to live, otherwise the cached data will never expire.
$cache->set('somethingCostlyToAcquire', $value, 60 * 60 * 24);
Caching multiple values at once
$cache->setMultiple([ 'foo' => $bar, 'hello' => $world, 'myObject' => $myObject ], 60 * 60 * 24);
Retrieving
Use ::get to retrieve your data, if the data doesn't exist in cache or has expired then a fallback value will be returned, which defaults to null if not informed.
$fallback = 'nothing here'; $cache->get('somethingCostlyToAcquire', $fallback);
Retrieving multiple values at once
$cache->getMultiple([ 'object1', 'value1', 'anotherObject' ], $fallback);
How to install
Use composer
composer require adinan-cenci/file-cache
License
MIT
统计信息
- 总下载量: 63
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-10-18