valeryq/cacheable
最新稳定版本:v1.1.0
Composer 安装命令:
composer require valeryq/cacheable
包简介
Laravel Cacheable
关键字:
README 文档
README
Requirements
- PHP >= 5.5.9
- Laravel >= 5.1
Installation
Require this package with composer:
composer require valeryq/cacheable
Usage
You must implements the Cacheable contract into your class and you can use the CacheableTrait instead realized methods from contract.
For example (for repositories):
<?php namespace App\Repositories\Cacheable; use App\Models\Product; use Valeryq\Cacheable\Contracts\Cacheable; use Valeryq\Cacheable\Traits\CacheableTrait; class CacheableProductRepository implements Cacheable { use CacheableTrait; /** * Find product by id * * @param $id * * @return Product * @throws ModelNotFoundException */ public function find($id) { return $this->cache()->remember('your_key', 60, function() { return Product::findOrFail($id); }); } .... }
License
The Laravel Cacheable is open-sourced software licensed under the MIT license
统计信息
- 总下载量: 101
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-11-05