anekdotes/cache
Composer 安装命令:
composer require anekdotes/cache
包简介
Allows caching using different drivers
README 文档
README
Allows caching using different drivers
Installation
Install via composer into your project:
composer require anekdotes/cache
Usage
Declare your Cache object depending on your Driver. After construction, all Cache objects can be manipulated the same way.
use Anekdotes\Cache\FileCache; $path = 'tmp/cache/'; //The slash at the end is IMPORTANT. MAKE SURE YOU HAVE IT! $cache = new FileCache($path); $key = 'Toaster'; $value = 'Test'; $minutes = 5; $cache->set($key, $value, $minutes); $cache->get('Toaster'); //Returns 'Test' as long as this call is made in a 5 minute time-frame past the previous set call. $cache->time('Toaster'); //Return the datetime object of when this key has been set $cache->forget('Toaster'); $cache->has('Toaster'); //Returns false.
Notes
-
The ArrayCache driver does not currently analyze expiration time. This means all array cached objects last forever.
-
The FileCache driver does not implement the increment and decrement functions. Both functions throw LogicException under this driver.
-
Setting a cache's expiration to zero will make it never expire. Using ```$cache->forever()````does the same thing.
-
You can use
$cache->flush()to remove all data in the cache.
统计信息
- 总下载量: 485
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-05-04