valeryq/cacheable 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

valeryq/cacheable

最新稳定版本:v1.1.0

Composer 安装命令:

composer require valeryq/cacheable

包简介

Laravel Cacheable

README 文档

README

Build Status Scrutinizer Scrutinizer Code Quality Total Downloads Latest Stable Version License

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

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-11-05