Backend
Less than 1 minute
Backend
Contract implemented by cache backend adapters.
interface BackendBackends are responsible for storing and retrieving cache values within a namespace, supporting key management operations, and exposing backend- specific option handling.
Methods
init
Initializes the backend for a cache namespace.
public init(string $namespace): voidParameters
| Parameter | Type | Description |
|---|---|---|
$namespace | string |
has
Checks whether a cache key exists in the backend.
public has(string $key, bool $checkEmpty): boolParameters
| Parameter | Type | Description |
|---|---|---|
$key | string | |
$checkEmpty | bool |
get
Retrieves a cached value by key.
public get(string $key): mixedParameters
| Parameter | Type | Description |
|---|---|---|
$key | string |
set
Stores a value in cache.
public set(string $key, mixed $value, int $timeout): boolParameters
| Parameter | Type | Description |
|---|---|---|
$key | string | |
$value | mixed | |
$timeout | int |
remove
Removes a cached key/value pair.
public remove(string $key): boolParameters
| Parameter | Type | Description |
|---|---|---|
$key | string |
clear
Clears all entries for the current namespace.
public clear(): booltoArray
Exports cached key/value pairs as an array snapshot.
public toArray(): voidcount
Counts entries currently stored in the active namespace.
public count(): intsetOption
Sets a backend-specific runtime option.
public setOption(string $key, mixed $value): voidParameters
| Parameter | Type | Description |
|---|---|---|
$key | string | |
$value | mixed |
Generated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:25 +0000