Simple request scope cache.
Returns object from cache. If there's no object for the given key and $functions is passed, $function result will be stored in cache under the given key.
Parameters: $key
, $function = null
Example:
$countries = Cache::get("countries", function() { //expensive computation that returns a list of countries return Country::all(); })
Stores the given object in the cache.
Parameters: $key
, $object
Returns true if cache contains an object for the given key.
Parameters: $key
Caches the result of the given closure using filename:line as a key.
Parameters: $function
Example:
$countries = Cache::memoize(function() { //expensive computation that returns a list of countries return Country::all(); })
Returns number of stored objects.
Clear all items stored in cache.