Method | Description | |
---|---|---|
clear ( ) | Clears all items stored in cache. | |
contains ( $key ) : boolean | Checks if cache contains an object for the given key. | |
get ( $key, null $function = null ) : mixed | null | Returns object from cache. | |
memoize ( $function ) : mixed | null | Caches the given closure using filename:line as a key. | |
put ( $key, $object ) : mixed | ||
size ( ) : integer | Returns number of stored objects. |
$countries = Cache::get("countries", function() {{
expensive computation that returns a list of countries
return Country:all();
})
$countries = Cache::memoize(function() {{
expensive computation that returns a list of countries
return Country:all();
})