cheese44/cheesecache
Composer 安装命令:
composer require cheese44/cheesecache
包简介
A request scoped cache library for PHP with the goal to make caching consistent and maintainable.
README 文档
README
A request scoped cache library for PHP with the goal to make caching consistent and maintainable.
Best used for caching function and query results that are called multiple times during a request and are unlikely to change
Installation
Package is available on Packagist, you can install it using Composer.
composer require cheese44/cheesecache
Usage
use cheeseCache\app; class Test { /** * cheeseCache does all the work for you * * you don't have to clutter your code with checking, setting and reading the cache yourself */ public function cacheSum($a, $b) { $cache = cheeseCache\app\cacheProvider::getCache(); $sum = $cache->cache( array($a, $b), function() use($a, $b) { return $a + $b; }); return $sum; } /** * of course cheeseCache still gives you the possibility to manually access these functionalities */ public function cacheSum_Explicit($a, $b) { $cache = cheeseCache\app\cacheProvider::getCache(); if($cache->isCacheSet(array($a, $b))): return $cache->geCacheValue(array($a, $b)); endif; $sum = $a + $b; $cache->cache( array($a, $b), $sum ); return $sum; } }
统计信息
- 总下载量: 18
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-22