Redis
About 2 min
Redis
- Full name:
\Hazaar\Cache\Backend\Redis
- Parent class:
\Hazaar\Cache\Backend
Properties
weight
protected int $weight
role
private array<int,mixed> $role
socket
private ?\Hazaar\Socket\Client $socket
master
private ?\Hazaar\Socket\Client $master
buffer
private string $buffer
offset
private int $offset
delim
private string $delim
updateExpire
private bool $updateExpire
local
private array $local
garbage
private string[] $garbage
Methods
available
public static available(): bool
- This method is static.
init
public init(string $namespace): void
Parameters:
Parameter | Type | Description |
---|---|---|
$namespace | string |
cmd
public cmd(array $cmds, bool $useMaster = false): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$cmds | array | |
$useMaster | bool |
select
public select(int $db): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$db | int |
close
public close(): bool
has
public has(string $key, bool $checkEmpty = false): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string | |
$checkEmpty | bool |
get
public get(string $key): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string |
set
public set(string $key, mixed $value, int $timeout): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string | |
$value | mixed | |
$timeout | int |
remove
public remove(string $key): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string |
clear
public clear(): bool
toArray
public toArray(): array
count
public count(): int
connect
private connect(string $host, int $port = 6379): \Hazaar\Socket\Client
Parameters:
Parameter | Type | Description |
---|---|---|
$host | string | |
$port | int |
getChunk
private getChunk(\Hazaar\Socket\Client $socket, ?int $bytes = null): string
Parameters:
Parameter | Type | Description |
---|---|---|
$socket | \Hazaar\Socket\Client | |
$bytes | ?int |
decode
Decodes a RESP data chunk.
private decode(\Hazaar\Socket\Client $socket, ?string $chunk = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$socket | \Hazaar\Socket\Client | |
$chunk | ?string |
encode
Encodes data into the RESP protocol.
private encode(mixed $data): string[]
Parameters:
Parameter | Type | Description |
---|---|---|
$data | mixed | The data to encode |
Return Value:
The encoded data
keepalive
private keepalive(): void
Inherited methods
__construct
Backend constructor.
final public __construct(array|\Hazaar\Map $options, string $namespace): mixed
- This method is final.
Parameters:
Parameter | Type | Description |
---|---|---|
$options | array|\Hazaar\Map | |
$namespace | string |
__destruct
public __destruct(): mixed
close
public close(): bool
can
public can(string $key): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string |
getWeight
public getWeight(): int
setOption
public setOption(string $key, mixed $value): void
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string | |
$value | mixed |
lock
public lock(string $key): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string |
unlock
public unlock(string $key): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string |
addCapabilities
protected addCapabilities(string $args): void
Parameters:
Parameter | Type | Description |
---|---|---|
$args | string |
configure
protected configure(array|\Hazaar\Map $options): void
Parameters:
Parameter | Type | Description |
---|---|---|
$options | array|\Hazaar\Map |
Automatically generated on 2024-11-14