Documentation

Cache
in

Tags
template

Table of Contents

Methods

delete()  : bool|null
Deletes a value associated with the given key if it exists.
get()  : TValue|null
Gets a value associated with the given key.
set()  : void
Sets a value associated with the given key. Overrides existing values (if they exist).

Methods

delete()

Deletes a value associated with the given key if it exists.

public delete(mixed $key) : bool|null

Implementations SHOULD return boolean true or false to indicate whether the specified key existed at the time the delete operation was requested. If such information is not available, the implementation MUST return null.

Implementations MUST NOT error for non-existent keys.

Parameters
$key : mixed

string Cache key.

Tags
throws
CacheException

On failure to delete the cached value

Return values
bool|null

Returns true / false to indicate whether the key existed, or null if that information is not available.

get()

Gets a value associated with the given key.

public get(mixed $key) : TValue|null

If the specified key doesn't exist implementations MUST return null.

Parameters
$key : mixed

string Cache key.

Tags
throws
CacheException

On failure to determine the cached value

Return values
TValue|null

Returns the cached value, or null if it doesn't exist

set()

Sets a value associated with the given key. Overrides existing values (if they exist).

public set(mixed $key, mixed $value[, mixed $ttl = null ]) : void

TTL values less than 0 MUST throw an \Error.

Parameters
$key : mixed

string Cache key.

$value : mixed

TValue Value to cache.

$ttl : mixed = null

int Timeout in seconds >= 0. The default null $ttl value indicates no timeout.

Tags
throws
CacheException

On failure to store the cached value


        
On this page

Search results