Cache

Class BlackFox\Cache is an interface that defines the work with the cache.
It doesn't work on its own, so it must be redefined in the config on one of the drivers:

Methods

Name Params Description Exception
Get string|array $key Retrieves value(s) by key(s), keeping type Value not found
Put string $key, $value,
int $ttl = null, array $tags = []
Saves the value to the specified key The value in the specified key already exists
Set Overwrites the value in the specified key, even if it already exists
Delete string $key Deletes a key value, if one exists
Strike string|array $tags Removes all keys and values associated with the specified tags
Clear Clears cache

Examples

try {
	$elements = \BlackFox\Cache::I()->Get('elements');
} catch (\BlackFox\ExceptionCache $error) {
	$elements = \Example\Elements::I()->Select();
	\BlackFox\Cache::I()->Set('elements', $elements);
}
return $elements;

More examples
Ask question