felixmaier1989/soft-cache
最新稳定版本:0.2
Composer 安装命令:
composer require felixmaier1989/soft-cache
包简介
Soft cache for your class methods
README 文档
README
Soft cache for your class methods. Sometimes, during one script run, one method is executed several times with the same arguments. Better caching the output of it, especially when querying a databse or an API.
Usage
class TestClass { use SoftCache\SoftCacheTrait; public function getNextYearsWithCache($yearFrom, $years) { if ($this->checkMethodCache(__FUNCTION__, func_get_args())) { return $this->readMethodCache(__FUNCTION__, func_get_args()); } $output = $this->getNextYearsWithoutCache($yearFrom, $years); $this->writeMethodCache(__FUNCTION__, func_get_args(), $output); return $output; } public function getNextYearsWithoutCache($yearFrom, $years) { return range($yearFrom + 1 , $yearFrom + $years); } }
统计信息
- 总下载量: 50.33k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-03-22