interface StoreInterface

Store interface.

Methods

bool
put(string $key, mixed $data, int $ttl = 0)

Store data in the cache.

bool
putIfNotExists(string $key, mixed $data, int $ttl = 0)

Store data in the cache if it doesn't already exist.

bool
has(string $key)

Returns TRUE if the cache key exists and FALSE if not.

mixed
get(string $key)

Fetch data from the cache. NULL will be returned if the item does not exist.

mixed
getOrElse(string $key, callable $callable, int $ttl = 0)

Fetch data from the cache or store it if it doesn't already exist.

bool
remove(string $key)

Delete data from the cache.

bool
clear()

Clears the cache.

Details

at line 23
bool put(string $key, mixed $data, int $ttl = 0)

Store data in the cache.

Parameters

string $key Cache key
mixed $data The data to store
int $ttl Time to live

Return Value

bool

at line 33
bool putIfNotExists(string $key, mixed $data, int $ttl = 0)

Store data in the cache if it doesn't already exist.

Parameters

string $key Cache key
mixed $data The data to store
int $ttl Time to live

Return Value

bool

at line 41
bool has(string $key)

Returns TRUE if the cache key exists and FALSE if not.

Parameters

string $key Cache key

Return Value

bool

at line 49
mixed get(string $key)

Fetch data from the cache. NULL will be returned if the item does not exist.

Parameters

string $key Cache key

Return Value

mixed

at line 59
mixed getOrElse(string $key, callable $callable, int $ttl = 0)

Fetch data from the cache or store it if it doesn't already exist.

Parameters

string $key Cache key
callable $callable Callable that returns the data we want to store
int $ttl Time to live

Return Value

mixed

at line 67
bool remove(string $key)

Delete data from the cache.

Parameters

string $key Cache key

Return Value

bool

at line 74
bool clear()

Clears the cache.

Return Value

bool