Backend
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): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$namespace | string |
has
Checks whether a cache key exists in the backend.
public has(string $key, bool $checkEmpty): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$key | string | |
$checkEmpty | bool |
get
Retrieves a cached value by key.
public get(string $key): mixedReturns: mixed
Parameters
| Parameter | Type | Description |
|---|---|---|
$key | string |
set
Stores a value in cache.
public set(string $key, mixed $value, int $timeout): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$key | string | |
$value | mixed | |
$timeout | int |
remove
Removes a cached key/value pair.
public remove(string $key): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$key | string |
clear
Clears all entries for the current namespace.
public clear(): boolReturns: bool
toArray
Exports cached key/value pairs as an array snapshot.
public toArray(): arrayReturns: array
count
Counts entries currently stored in the active namespace.
public count(): intReturns: int
setOption
Sets a backend-specific runtime option.
public setOption(string $key, mixed $value): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$key | string | |
$value | mixed |
Generated by Hazaar API Doc Generator on Fri, 04 Sep 2026 23:32:16 +0000