KVStore
KVStore
In-memory key/value store component with optional persistence.
class KVStoreProperties
server
Owning server instance.
private Main $serverlog
Logger used for KV operation diagnostics.
private Logger $logconfig
Configuration for the KV Store component.
private array $configkvStore
private array $kvStorekvExpire
private array $kvExpiredb
public BTree $dbcompactTime
Interval (seconds) between persistence compaction runs.
private int $compactTimelastCompact
Timestamp of the most recent compaction.
private int $lastCompactMethods
__construct
KVStore constructor.
public __construct(Main $server, array $config): voidParameters
| Parameter | Type | Description |
|---|---|---|
$server | Main | the server instance |
$config | array | configuration for the KV Store component |
enablePersistentStorage
Enables persistent KV storage and optional auto-compaction.
public enablePersistentStorage(int $compactTime = 3600): boolParameters
| Parameter | Type | Description |
|---|---|---|
$compactTime | int |
disablePersistentStorage
Disables persistent storage and compaction state.
public disablePersistentStorage(): voidexpireKeys
Expires keys that reached TTL and compacts persistence if due.
public expireKeys(): voidtouch
public touch(string $namespace, string $key): voidParameters
| Parameter | Type | Description |
|---|---|---|
$namespace | string | |
$key | string |
process
Dispatches inbound KV commands to the matching handler.
public process(Client $client, PacketType $command, mixed $payload): voidParameters
| Parameter | Type | Description |
|---|---|---|
$client | Client | |
$command | PacketType | |
$payload | mixed |
get
Handles KVGET command.
public get(Client $client, mixed $payload, string $namespace): voidParameters
| Parameter | Type | Description |
|---|---|---|
$client | Client | |
$payload | mixed | |
$namespace | string |
set
Handles KVSET command.
public set(Client $client, mixed $payload, string $namespace): voidParameters
| Parameter | Type | Description |
|---|---|---|
$client | Client | |
$payload | mixed | |
$namespace | string |
has
Handles KVHAS command.
public has(Client $client, \stdClass $payload, string $namespace): voidParameters
| Parameter | Type | Description |
|---|---|---|
$client | Client | |
$payload | \stdClass | |
$namespace | string |
del
Handles KVDEL command.
public del(Client $client, \stdClass $payload, string $namespace): voidParameters
| Parameter | Type | Description |
|---|---|---|
$client | Client | |
$payload | \stdClass | |
$namespace | string |
Handles KVLIST command.
public (Client $client, \stdClass $payload, string $namespace): voidParameters
| Parameter | Type | Description |
|---|---|---|
$client | Client | |
$payload | \stdClass | |
$namespace | string |
clear
Handles KVCLEAR command.
public clear(Client $client, \stdClass $payload, string $namespace): voidParameters
| Parameter | Type | Description |
|---|---|---|
$client | Client | |
$payload | \stdClass | |
$namespace | string |
pull
Handles KVPULL command.
public pull(Client $client, \stdClass $payload, string $namespace): voidParameters
| Parameter | Type | Description |
|---|---|---|
$client | Client | |
$payload | \stdClass | |
$namespace | string |
push
Handles KVPUSH command.
public push(Client $client, \stdClass $payload, string $namespace): voidParameters
| Parameter | Type | Description |
|---|---|---|
$client | Client | |
$payload | \stdClass | |
$namespace | string |
pop
Handles KVPOP command.
public pop(Client $client, \stdClass $payload, string $namespace): voidParameters
| Parameter | Type | Description |
|---|---|---|
$client | Client | |
$payload | \stdClass | |
$namespace | string |
shift
Handles KVSHIFT command.
public shift(Client $client, \stdClass $payload, string $namespace): voidParameters
| Parameter | Type | Description |
|---|---|---|
$client | Client | |
$payload | \stdClass | |
$namespace | string |
unshift
Handles KVUNSHIFT command.
public unshift(Client $client, \stdClass $payload, string $namespace): voidParameters
| Parameter | Type | Description |
|---|---|---|
$client | Client | |
$payload | \stdClass | |
$namespace | string |
count
Handles KVCOUNT command.
public count(Client $client, \stdClass $payload, string $namespace): voidParameters
| Parameter | Type | Description |
|---|---|---|
$client | Client | |
$payload | \stdClass | |
$namespace | string |
incr
Handles KVINCR command.
public incr(Client $client, \stdClass $payload, string $namespace): voidParameters
| Parameter | Type | Description |
|---|---|---|
$client | Client | |
$payload | \stdClass | |
$namespace | string |
decr
Handles KVDECR command.
public decr(Client $client, \stdClass $payload, string $namespace): voidParameters
| Parameter | Type | Description |
|---|---|---|
$client | Client | |
$payload | \stdClass | |
$namespace | string |
keys
Handles KVKEYS command.
public keys(Client $client, \stdClass $payload, string $namespace): voidParameters
| Parameter | Type | Description |
|---|---|---|
$client | Client | |
$payload | \stdClass | |
$namespace | string |
values
Handles KVVALS command.
public values(Client $client, \stdClass $payload, string $namespace): voidParameters
| Parameter | Type | Description |
|---|---|---|
$client | Client | |
$payload | \stdClass | |
$namespace | string |
Generated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:25 +0000