承接 d076/laravel-cache-helper 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

d076/laravel-cache-helper

最新稳定版本:v1.0.0

Composer 安装命令:

composer require d076/laravel-cache-helper

包简介

Small helper for Laravel Cache facade

README 文档

README

Laravel v10.x PHP 8.2

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-11-06