All Projects → deathkel → Easy Cache

deathkel / Easy Cache

Licence: mit
a cache trait for Laravel to do cache eaily

Projects that are alternatives of or similar to Easy Cache

Htmlcache
Laravel middleware to cache the rendered html
Stars: ✭ 35 (+191.67%)
Mutual labels:  cache, laravel
Laravel Responsecache
Speed up a Laravel app by caching the entire response
Stars: ✭ 1,874 (+15516.67%)
Mutual labels:  cache, laravel
Api Restful Con Laravel Guia Definitiva
Repositorio para el código base del curso "API RESTful con Laravel - Guía Definitiva"
Stars: ✭ 95 (+691.67%)
Mutual labels:  cache, laravel
Laravel Couchbase
Couchbase providers for Laravel
Stars: ✭ 31 (+158.33%)
Mutual labels:  cache, laravel
Lada Cache
A Redis based, fully automated and scalable database cache layer for Laravel
Stars: ✭ 424 (+3433.33%)
Mutual labels:  cache, laravel
Laravel Cacheable
Rinvex Cacheable is a granular, intuitive, and fluent caching system for eloquent models. Simple, but yet powerful, plug-n-play with no hassle.
Stars: ✭ 107 (+791.67%)
Mutual labels:  cache, laravel
Laravel Blink
Cache that expires in the blink of an eye
Stars: ✭ 114 (+850%)
Mutual labels:  cache, laravel
Thinkgo
A lightweight MVC framework written in Go (Golang).
Stars: ✭ 184 (+1433.33%)
Mutual labels:  cache, laravel
Laravel App Settings
Store settings in database with a manager UI for your Laravel app
Stars: ✭ 220 (+1733.33%)
Mutual labels:  cache, laravel
Laravel Partialcache
Blade directive to cache rendered partials in laravel
Stars: ✭ 205 (+1608.33%)
Mutual labels:  cache, laravel
Laravel Repositories
[ABANDONED] Rinvex Repository is a simple, intuitive, and smart implementation of Active Repository with extremely flexible & granular caching system for Laravel, used to abstract the data layer, making applications more flexible to maintain.
Stars: ✭ 664 (+5433.33%)
Mutual labels:  cache, laravel
Laravel Eloquent Query Cache
Adding cache on your Laravel Eloquent queries' results is now a breeze.
Stars: ✭ 529 (+4308.33%)
Mutual labels:  cache, laravel
Simple Cache
An easy to use Caching trait for Laravel's Eloquent Models.
Stars: ✭ 19 (+58.33%)
Mutual labels:  cache, laravel
Laravel Mail Preview
A mail driver to quickly preview mail
Stars: ✭ 851 (+6991.67%)
Mutual labels:  laravel
Laravel Pay
可能是我用过的最优雅的 Alipay 和 WeChat 的 laravel 支付扩展包了
Stars: ✭ 856 (+7033.33%)
Mutual labels:  laravel
Base
Until 2018, Backpack v3 used this Base package to offer admin authentication and a blank admin panel using AdminLTE. Backpack v4 no longer uses this package, they're now built-in - use Backpack/CRUD instead.
Stars: ✭ 848 (+6966.67%)
Mutual labels:  laravel
Foocart
A Laravel 5 eCommerce application with integrated Stripe payments.
Stars: ✭ 8 (-33.33%)
Mutual labels:  laravel
Blender
The Laravel template used for our CMS like projects
Stars: ✭ 862 (+7083.33%)
Mutual labels:  laravel
Deployer
Deployer is a free and open source deployment tool.
Stars: ✭ 854 (+7016.67%)
Mutual labels:  laravel
Gparticlesio
Simple IO transfer particles cache in DCC application
Stars: ✭ 8 (-33.33%)
Mutual labels:  cache

A Trait to use cache easily for Laravel

Latest Version on Packagist Software License Build Status Quality Score Total Downloads

INSTALL

composer require deathkel/easy-cache

USAGE

  • this trait will auto cache protect function
  • default cache time is 60 minutes. you can define a static variable $expire for each function
public class test(){

    use EasyCacheTrait;
    
    public function __construct(){
        $this->default_expire = 1; //change default expire time (min)
    }
    
    public function DontWantToBeCache(){ // public function will not be cached
        //.....
    }

    protected function WantToBeCache(){ // protected function will be cached automatically
        static $expire = 60; //minute that this function want to be cached
    }
    
    private static function _getCacheKeyPrefixLevel1(){
        return "test:"; //overwrite cache prefix level 1, default is class name
    }
    
    private static function _getCacheKeyPrefixLevel2($method){
        return self::_getCacheKeyPrefixLevel1() . $method . ":"; //overwrite cache prefix level 2
    }
    
    private static function _getCacheKey($method, $params){
        return self::_getCacheKeyPrefixLevel2($method) . md5(json_encode($params)); //overwrite cache key
    }
}

delete cache

  • call method forgetCache to delete all cache in class
  • call method forgetMethodCache to delete all cache in the method

when in debug pattern

  • add 'skipCache=1' to http query param will skip cache and exec function
  • add 'forgetCache=1' to http query param will forget cache and restore cache

TODO

  • add test example

License

The MIT License (MIT). Please see License File for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].