CacheEngineInterface
in
Interface for cache engines that defines methods outside of the PSR16 interface that are used by `Cache`.
Internally Cache uses this interface when calling engine methods.
Tags
Table of Contents
Methods
- add() : bool
- Write data for key into a cache engine if it doesn't exist already.
- clearGroup() : bool
- Clear all values belonging to the named group.
- decrement() : int|false
- Decrement a number under the key and return decremented value
- increment() : int|false
- Increment a number under the key and return incremented value
Methods
add()
Write data for key into a cache engine if it doesn't exist already.
public
add(string $key, mixed $value) : bool
Parameters
- $key : string
-
Identifier for the data.
- $value : mixed
-
Data to be cached - anything except a resource.
Return values
bool —True if the data was successfully cached, false on failure. Or if the key existed already.
clearGroup()
Clear all values belonging to the named group.
public
clearGroup(string $group) : bool
Each implementation needs to decide whether actually delete the keys or just augment a group generation value to achieve the same result.
Parameters
- $group : string
-
name of the group to be cleared
Return values
booldecrement()
Decrement a number under the key and return decremented value
public
decrement(string $key[, int $offset = 1 ]) : int|false
Parameters
- $key : string
-
Identifier for the data
- $offset : int = 1
-
How much to subtract
Return values
int|false —New incremented value, false otherwise
increment()
Increment a number under the key and return incremented value
public
increment(string $key[, int $offset = 1 ]) : int|false
Parameters
- $key : string
-
Identifier for the data
- $offset : int = 1
-
How much to add
Return values
int|false —New incremented value, false otherwise