d076/laravel-cache-helper
最新稳定版本:v1.0.0
Composer 安装命令:
composer require d076/laravel-cache-helper
包简介
Small helper for Laravel Cache facade
README 文档
README
Small helper for Laravel Cache facade
Quick Setup
composer require d076/laravel-cache-helper
Usage
Add HasCached trait to your class which methods you want to cache.
use D076\LaravelCacheHelper\Traits\HasCached; class SomeClass { use HasCached; public function someMethod($params) { ... } public static function someStaticMethod($params) { ... } }
Important
Your class or parent classes/traits should not contain override __call and __callStatic methods. So you can`t use HasCached trait in your Models.
Now you can call your methods with Cached or ForceCached prefix.
Optionally, you can pass last parameter $ttl in seconds.
$someClass->someMethodCached($params, $ttl); $someClass->someMethodForceCached($params, $ttl); SomeClass::someStaticMethodCached($params, $ttl); SomeClass::someStaticMethodForceCached($params, $ttl);
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-11-06