Skip to main content
Version: Fegg 5.x

Cache::get

Read a kept value

Description​

public static mixed Cache::get( string $key [, mixed $default = null ] )

Returns the value of $key, or $default when there is none or it has expired.

Arguments​

NameData typeDefaultRemarks
$keystringName of the value
$defaultmixednullReturned when there is no value

Example​

Controller
use Fegg\Tool\Cache;

$ranking = Cache::get('ranking', array());

A kept null cannot be told apart from a missing value: use has() for that.