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.

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 25
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 35
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 43
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 51
mixed get(string $key)

Fetch data from the cache.

Parameters

string $key Cache key

Return Value

mixed

at line 61
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 69
bool remove(string $key)

Delete data from the cache.

Parameters

string $key Cache key

Return Value

bool

at line 76
bool clear()

Clears the cache.

Return Value

bool