Leaf PHP

Adapter

Redis Adapter ------------- Contract for redis adapters

Table of Contents

Methods

close()  : void
Close the redis connection
connect()  : void
Initialize redis and connect to redis instance
connection()  : mixed
Get the redis connection
delete()  : bool
Delete a key from redis
errors()  : array<string|int, mixed>
Get all saved errors
exists()  : bool
Check if a key exists in redis
flush()  : bool
Flush all keys in redis
get()  : mixed
Get a value from redis
keys()  : array<string|int, mixed>
Get all keys in redis
ping()  : string|false
Ping the redis server
set()  : mixed
Set a value in redis

Methods

close()

Close the redis connection

public close() : void

connect()

Initialize redis and connect to redis instance

public connect([array<string|int, mixed> $config = [] ]) : void
Parameters
$config : array<string|int, mixed> = []

Configuration for the redis instance.

connection()

Get the redis connection

public connection() : mixed

delete()

Delete a key from redis

public delete(string|array<string|int, mixed> $key) : bool
Parameters
$key : string|array<string|int, mixed>

The key to delete

Return values
bool

errors()

Get all saved errors

public errors() : array<string|int, mixed>
Return values
array<string|int, mixed>

exists()

Check if a key exists in redis

public exists(string $key) : bool
Parameters
$key : string

The key to check

Return values
bool

flush()

Flush all keys in redis

public flush() : bool
Return values
bool

get()

Get a value from redis

public get(string|array<string|int, mixed> $key) : mixed
Parameters
$key : string|array<string|int, mixed>

The key to get

keys()

Get all keys in redis

public keys() : array<string|int, mixed>
Return values
array<string|int, mixed>

ping()

Ping the redis server

public ping([string|null $message = null ]) : string|false
Parameters
$message : string|null = null

The message to send

Return values
string|false

set()

Set a value in redis

public set(string $key, mixed $value[, int $ttl = 0 ]) : mixed
Parameters
$key : string

The key to set

$value : mixed

The value to set

$ttl : int = 0

The time to live for the key


        
On this page

Search results