class Database implements Database (View source)

Properties

protected array $clients The host address of the database.

Methods

void
__construct(array $servers = [])

Create a new Redis connection instance.

array
createAggregateClient(array $servers, array $options = [])

Create a new aggregate client supporting sharding.

array
createSingleClients(array $servers, array $options = [])

Create an array of single connection clients.

ClientInterface|null
connection(string $name = 'default')

Get a specific Redis connection instance.

mixed
command(string $method, array $parameters = [])

Run a command against the Redis database.

void
subscribe(array|string $channels, Closure $callback, string $connection = null, string $method = 'subscribe')

Subscribe to a set of given channels for messages.

void
psubscribe(array|string $channels, Closure $callback, string $connection = null)

Subscribe to a set of given channels with wildcards.

mixed
__call(string $method, array $parameters)

Dynamically make a Redis command.

Details

void __construct(array $servers = [])

Create a new Redis connection instance.

Parameters

array $servers

Return Value

void

protected array createAggregateClient(array $servers, array $options = [])

Create a new aggregate client supporting sharding.

Parameters

array $servers
array $options

Return Value

array

protected array createSingleClients(array $servers, array $options = [])

Create an array of single connection clients.

Parameters

array $servers
array $options

Return Value

array

ClientInterface|null connection(string $name = 'default')

Get a specific Redis connection instance.

Parameters

string $name

Return Value

ClientInterface|null

mixed command(string $method, array $parameters = [])

Run a command against the Redis database.

Parameters

string $method
array $parameters

Return Value

mixed

void subscribe(array|string $channels, Closure $callback, string $connection = null, string $method = 'subscribe')

Subscribe to a set of given channels for messages.

Parameters

array|string $channels
Closure $callback
string $connection
string $method

Return Value

void

void psubscribe(array|string $channels, Closure $callback, string $connection = null)

Subscribe to a set of given channels with wildcards.

Parameters

array|string $channels
Closure $callback
string $connection

Return Value

void

mixed __call(string $method, array $parameters)

Dynamically make a Redis command.

Parameters

string $method
array $parameters

Return Value

mixed