CacheInterface
in
Table of Contents
Methods
- clean() : bool
- Will delete all items in the entire cache.
- decrement() : bool|int
- Performs atomic decrementation of a raw stored value.
- delete() : bool
- Deletes a specific item from the cache store.
- deleteMatching() : int
- Deletes items from the cache store matching a given pattern.
- get() : mixed
- Attempts to fetch an item from the cache store.
- getCacheInfo() : array<string|int, mixed>|false|object|null
- Returns information on the entire cache.
- getMetaData() : array<string, mixed>|null
- Returns detailed information about the specific item in the cache.
- increment() : bool|int
- Performs atomic incrementation of a raw stored value.
- initialize() : void
- Takes care of any handler-specific setup that must be done.
- isSupported() : bool
- Determines if the driver is supported on this system.
- remember() : mixed
- Attempts to get an item from the cache, or executes the callback and stores the result on cache miss.
- save() : bool
- Saves an item to the cache store.
Methods
clean()
Will delete all items in the entire cache.
public
clean() : bool
Return values
bool —Success or failure
decrement()
Performs atomic decrementation of a raw stored value.
public
decrement(string $key[, int $offset = 1 ]) : bool|int
Parameters
- $key : string
-
Cache ID
- $offset : int = 1
-
Step/value to increase by
Return values
bool|intdelete()
Deletes a specific item from the cache store.
public
delete(string $key) : bool
Parameters
- $key : string
-
Cache item name
Return values
bool —Success or failure
deleteMatching()
Deletes items from the cache store matching a given pattern.
public
deleteMatching(string $pattern) : int
Parameters
- $pattern : string
-
Cache items glob-style pattern
Return values
int —Number of deleted items
get()
Attempts to fetch an item from the cache store.
public
get(string $key) : mixed
Parameters
- $key : string
-
Cache item name
getCacheInfo()
Returns information on the entire cache.
public
getCacheInfo() : array<string|int, mixed>|false|object|null
The information returned and the structure of the data varies depending on the handler.
Return values
array<string|int, mixed>|false|object|nullgetMetaData()
Returns detailed information about the specific item in the cache.
public
getMetaData(string $key) : array<string, mixed>|null
Parameters
- $key : string
-
Cache item name.
Return values
array<string, mixed>|null —Returns null if the item does not exist, otherwise array<string, mixed> with at least the 'expire' key for absolute epoch expiry (or null).
increment()
Performs atomic incrementation of a raw stored value.
public
increment(string $key[, int $offset = 1 ]) : bool|int
Parameters
- $key : string
-
Cache ID
- $offset : int = 1
-
Step/value to increase by
Return values
bool|intinitialize()
Takes care of any handler-specific setup that must be done.
public
initialize() : void
isSupported()
Determines if the driver is supported on this system.
public
isSupported() : bool
Return values
boolremember()
Attempts to get an item from the cache, or executes the callback and stores the result on cache miss.
public
remember(string $key, int $ttl, callable(): mixed $callback) : mixed
Parameters
- $key : string
-
Cache item name
- $ttl : int
-
Time To Live, in seconds
- $callback : callable(): mixed
-
Callback executed on cache miss
save()
Saves an item to the cache store.
public
save(string $key, mixed $value[, int $ttl = 60 ]) : bool
Parameters
- $key : string
-
Cache item name
- $value : mixed
-
The data to save
- $ttl : int = 60
-
Time To Live, in seconds (default 60)
Return values
bool —Success or failure