sylweriusz/taggedcache
Composer 安装命令:
composer require sylweriusz/taggedcache
包简介
Cache (redis or memcache), fast delete, optionally based on tags
关键字:
README 文档
README
Very simple caching, optionally with tags for fast delete of some key groups.
Installation with composer
composer require sylweriusz/taggedcache
Initialization
$cache = new \TaggedCache\Memcache('127.0.0.1'); //memcache server address //or $cache = new \TaggedCache\Redis('192.168.1.34'); //redis server address
###Usage
$key = md5("item name and unique params ".json_encode($params)); $tags = ['tag_for_delete']; //try from cache, and save if not exists if (!$result = $cache->load($key, $tags)){ $result = json_encode($params); // anything time consuming what You want to do with $params $cache->save($result, $key, $tags, 1200); //remember this for 1200 sec }
###Cache Clean
//clean all items $cache->clean('all'); //if one of $params get changed do somethink like this $cache->clean('matchingAnyTag',['tag_for_delete', 'or_another_tag']);
统计信息
- 总下载量: 144
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2016-04-01