akalod/cache

There is no license information available for the latest version (dev-master) of this package.

Basic Cache Module

dev-master 2022-07-06 17:57 UTC

This package is auto-updated.

Last update: 2024-04-06 21:42:53 UTC


README

basic redis cache operator

install

composer require akalod/cache

examples

use Akalod/Cache;

//init redis connection
Cache::init(); //host, port, authPass, 

//set Default cacheTime
Cache::cacheTime = 200; 

//set 
Cache::set('key','value',400); // key, value, cacheTime

//get
Cache::get('key');

//set and get with callback example
$result = Cache::getSet('keyName', function () {
            //value
            return DB::table('pages')
                ->where('status', 1)
                ->where('group', 1)
                ->orderBy('short', 'asc')
                ->get(['seo', 'title', 'page_title']);
    }, 700); //key, callback, cacheTime