PHP Class Mongolid\Util\CacheComponent

Inheritance: implements Mongolid\Util\CacheComponentInterface
Afficher le fichier Open project: leroy-merlin-br/mongolid

Protected Properties

Свойство Type Description
$storage array The array of stored values.
$ttl array Time to live of each stored value.

Méthodes publiques

Méthode Description
get ( string $key ) : mixed Retrieve an item from the cache by key.
has ( string $key ) : boolean Determine if an item exists in the cache. This method will also check if the ttl of the given cache key has been expired and will free the memory if so.
put ( string $key, mixed $value, float $minutes ) : void Store an item in the cache for a given number of minutes.

Méthodes protégées

Méthode Description
time ( ) : integer Return the current time in order to check ttl.

Method Details

get() public méthode

Retrieve an item from the cache by key.
public get ( string $key ) : mixed
$key string Cache key of the item to be retrieved.
Résultat mixed

has() public méthode

Determine if an item exists in the cache. This method will also check if the ttl of the given cache key has been expired and will free the memory if so.
public has ( string $key ) : boolean
$key string Cache key of the item.
Résultat boolean Has cache key.

put() public méthode

Store an item in the cache for a given number of minutes.
public put ( string $key, mixed $value, float $minutes ) : void
$key string Cache key of the item.
$value mixed Value being stored in cache.
$minutes float Cache ttl.
Résultat void

time() protected méthode

Return the current time in order to check ttl.
protected time ( ) : integer
Résultat integer Return current Unix timestamp.

Property Details

$storage protected_oe property

The array of stored values.
protected array $storage
Résultat array

$ttl protected_oe property

Time to live of each stored value.
protected array $ttl
Résultat array