Core\Cache cache()
Store data in the systems cache.
// Set a cache using the key "foo" with the value "bar" cache()->set('foo', 'bar'); // Get the value for "foo" echo cache()->get('foo'); // Store an array in cache cache()->set('foo_array', [ 'hello' => 'world' ]); // Get an array from cache $array = cache()->get('foo_array'); print_r($array); // Will output: Array ( [hello] => world ) // Delete an entry from cache cache()->del('foo'); |
Method | Description | Usage | Returns | ||
---|---|---|---|---|---|
get(string $key)
$key Unique cache key.
| Get data from cache based on a key. |
| On success it returns the value, false if its not cached. | ||
set(string $key, mixed $value )
$key Unique storage key. $value Value to set for this entry. Can be a string, array, int or boolean. | Sets data cache data based on your key.
|
| Returns the cached value on success, false on failure. | ||
del(string $key)
$key Unique cache key. | Deletes an entry from cache |
| null | ||
purge() | Deletes all entries from cache. |
| null |