Skip to content
StefansArya edited this page Apr 17, 2019 · 4 revisions

You may need to assign the namespace to the top of your code

use \Scarlets\Library\Cache;

get

Cache::get(key, default=null);

The example below will return data from timestamp key
but if the key was not found or expired, then it will return
default value.

$data = Cache::get('timestamp', 0);

set

Cache::set(key, value, seconds=0);

The example below will set time() on timestamp key
and expired after 20 second.

$data = Cache::set('timestamp', time(), 20);

These function will be documented later has, pull, forget, flush, extendTime

Clone this wiki locally