KVStore
KVStore
In-memory key/value store component with optional persistence.
class KVStoreProperties
server
Owning server instance.
private Main $serverType: Hazaar\Warlock\Server\Main
log
Logger used for KV operation diagnostics.
private Logger $logType: Hazaar\Warlock\Logger
options
Configuration for the KV Store component.
private Options $optionsType: Hazaar\Warlock\Server\Component\KVStore\Options
kvStore
private array $kvStoreType: array
kvExpire
private array $kvExpireType: array
db
public BTree $dbType: Hazaar\Util\BTree
compactTime
Interval (seconds) between persistence compaction runs.
private int $compactTimeType: int
lastCompact
Timestamp of the most recent compaction.
private int $lastCompactType: int
Methods
__construct
KVStore constructor.
public __construct(Main $server, Options $options = 'new Options()'): voidParameters
| Parameter | Type | Description |
|---|---|---|
$server | Hazaar\Warlock\Server\Main | the server instance |
$options | Hazaar\Warlock\Server\Component\KVStore\Options | configuration for the KV Store component |
enablePersistentStorage
Enables persistent KV storage and optional auto-compaction.
public enablePersistentStorage(int $compactTime = 3600): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$compactTime | int |
disablePersistentStorage
Disables persistent storage and compaction state.
public disablePersistentStorage(): voidReturns: void
expireKeys
Expires keys that reached TTL and compacts persistence if due.
public expireKeys(): voidReturns: void
touch
public touch(string $namespace, string $key): arrayReturns: array
Parameters
| Parameter | Type | Description |
|---|---|---|
$namespace | string | |
$key | string |
process
Dispatches inbound KV commands to the matching handler.
public process(Client $client, PacketType $command, ?\stdClass $payload): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$client | Hazaar\Warlock\Server\Client | |
$command | Hazaar\Warlock\Enum\PacketType | |
$payload | stdClass |
get
Handles KVGET command.
public get(Client $client, \stdClass $payload, string $namespace): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$client | Hazaar\Warlock\Server\Client | |
$payload | stdClass | |
$namespace | string |
set
Handles KVSET command.
public set(Client $client, \stdClass $payload, string $namespace): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$client | Hazaar\Warlock\Server\Client | |
$payload | stdClass | |
$namespace | string |
has
Handles KVHAS command.
public has(Client $client, \stdClass $payload, string $namespace): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$client | Hazaar\Warlock\Server\Client | |
$payload | stdClass | |
$namespace | string |
del
Handles KVDEL command.
public del(Client $client, \stdClass $payload, string $namespace): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$client | Hazaar\Warlock\Server\Client | |
$payload | stdClass | |
$namespace | string |
Handles KVLIST command.
public (Client $client, \stdClass $payload, string $namespace): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$client | Hazaar\Warlock\Server\Client | |
$payload | stdClass | |
$namespace | string |
clear
Handles KVCLEAR command.
public clear(Client $client, \stdClass $payload, string $namespace): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$client | Hazaar\Warlock\Server\Client | |
$payload | stdClass | |
$namespace | string |
pull
Handles KVPULL command.
public pull(Client $client, \stdClass $payload, string $namespace): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$client | Hazaar\Warlock\Server\Client | |
$payload | stdClass | |
$namespace | string |
push
Handles KVPUSH command.
public push(Client $client, \stdClass $payload, string $namespace): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$client | Hazaar\Warlock\Server\Client | |
$payload | stdClass | |
$namespace | string |
pop
Handles KVPOP command.
public pop(Client $client, \stdClass $payload, string $namespace): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$client | Hazaar\Warlock\Server\Client | |
$payload | stdClass | |
$namespace | string |
shift
Handles KVSHIFT command.
public shift(Client $client, \stdClass $payload, string $namespace): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$client | Hazaar\Warlock\Server\Client | |
$payload | stdClass | |
$namespace | string |
unshift
Handles KVUNSHIFT command.
public unshift(Client $client, \stdClass $payload, string $namespace): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$client | Hazaar\Warlock\Server\Client | |
$payload | stdClass | |
$namespace | string |
count
Handles KVCOUNT command.
public count(Client $client, \stdClass $payload, string $namespace): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$client | Hazaar\Warlock\Server\Client | |
$payload | stdClass | |
$namespace | string |
incr
Handles KVINCR command.
public incr(Client $client, \stdClass $payload, string $namespace): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$client | Hazaar\Warlock\Server\Client | |
$payload | stdClass | |
$namespace | string |
decr
Handles KVDECR command.
public decr(Client $client, \stdClass $payload, string $namespace): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$client | Hazaar\Warlock\Server\Client | |
$payload | stdClass | |
$namespace | string |
keys
Handles KVKEYS command.
public keys(Client $client, \stdClass $payload, string $namespace): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$client | Hazaar\Warlock\Server\Client | |
$payload | stdClass | |
$namespace | string |
values
Handles KVVALS command.
public values(Client $client, \stdClass $payload, string $namespace): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$client | Hazaar\Warlock\Server\Client | |
$payload | stdClass | |
$namespace | string |
Generated by Hazaar API Doc Generator on Fri, 04 Sep 2026 23:32:17 +0000