PhpRedisConnection

class PhpRedisConnection extends Connection implements Connection (View source)

Properties

protected Client $client The Predis client. from Connection

Methods

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

Subscribe to a set of given channels for messages.

ConcurrencyLimiterBuilder funnel(string $name)

Funnel a callback for a maximum number of simultaneous executions.

from Connection
DurationLimiterBuilder throttle(string $name)

Throttle a callback for a maximum number of executions over a given duration.

from Connection
mixed client()

Get the underlying Redis client.

from Connection
void subscribe(array|string $channels, Closure $callback)

Subscribe to a set of given channels for messages.

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

Subscribe to a set of given channels with wildcards.

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

Run a command against the Redis database.

from Connection
mixed __call(string $method, array $parameters)

Pass other method calls down to the underlying client.

void __construct(Redis $client)

Create a new PhpRedis connection.

string|null get(string $key)

Returns the value of the given key.

array mget(array $keys)

Get the values of all the given keys.

int exists(dynamic $keys)

Determine if the given keys exist.

bool set(string $key, mixed $value, string|null $expireResolution = null, int|null $expireTTL = null, string|null $flag = null)

Set the string value in argument as value of the key.

int setnx(string $key, string $value)

Set the given key if it doesn't exist.

int hmget(string $key, dynamic $dictionary)

Get the value of the given hash fields.

int hmset(string $key, dynamic $dictionary)

Set the given hash fields to their respective values.

int hsetnx(string $hash, string $key, string $value)

Set the given hash field if it doesn't exist.

int|false lrem(string $key, int $count, $value)

Removes the first count occurrences of the value element from the list.

mixed|false spop(string $key, int|null $count = null)

Removes and returns a random element from the set value at key.

int zadd(string $key, dynamic $dictionary)

Add one or more members to a sorted set or update its score if it already exists.

int zrangebyscore(string $key, mixed $min, mixed $max, array $options = [])

Return elements with score between $min and $max.

int zrevrangebyscore(string $key, mixed $min, mixed $max, array $options = [])

Return elements with score between $min and $max.

int zinterstore(string $output, array $keys, array $options = [])

Find the intersection between sets and store in a new set.

int zunionstore(string $output, array $keys, array $options = [])

Find the union between sets and store in a new set.

Redis|array pipeline(callable $callback = null)

Execute commands in a pipeline.

Redis|array transaction(callable $callback = null)

Execute commands in a transaction.

mixed evalsha(string $script, int $numkeys, mixed $arguments)

Evaluate a LUA script serverside, from the SHA1 hash of the script instead of the script itself.

mixed eval(string $script, int $numberOfKeys, dynamic $arguments)

Evaluate a script and return its result.

mixed executeRaw(array $parameters)

Execute a raw command.

void disconnect()

Disconnects from the Redis instance.

Details

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

Subscribe to a set of given channels for messages.

Parameters

array|string $channels
Closure $callback
string $method

Return Value

void

ConcurrencyLimiterBuilder funnel(string $name)

Funnel a callback for a maximum number of simultaneous executions.

Parameters

string $name

Return Value

ConcurrencyLimiterBuilder

DurationLimiterBuilder throttle(string $name)

Throttle a callback for a maximum number of executions over a given duration.

Parameters

string $name

Return Value

DurationLimiterBuilder

mixed client()

Get the underlying Redis client.

Return Value

mixed

void subscribe(array|string $channels, Closure $callback)

Subscribe to a set of given channels for messages.

Parameters

array|string $channels
Closure $callback

Return Value

void

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

Subscribe to a set of given channels with wildcards.

Parameters

array|string $channels
Closure $callback

Return Value

void

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

Run a command against the Redis database.

Parameters

string $method
array $parameters

Return Value

mixed

mixed __call(string $method, array $parameters)

Pass other method calls down to the underlying client.

Parameters

string $method
array $parameters

Return Value

mixed

void __construct(Redis $client)

Create a new PhpRedis connection.

Parameters

Redis $client

Return Value

void

string|null get(string $key)

Returns the value of the given key.

Parameters

string $key

Return Value

string|null

array mget(array $keys)

Get the values of all the given keys.

Parameters

array $keys

Return Value

array

int exists(dynamic $keys)

Determine if the given keys exist.

Parameters

dynamic $keys

Return Value

int

bool set(string $key, mixed $value, string|null $expireResolution = null, int|null $expireTTL = null, string|null $flag = null)

Set the string value in argument as value of the key.

Parameters

string $key
mixed $value
string|null $expireResolution
int|null $expireTTL
string|null $flag

Return Value

bool

int setnx(string $key, string $value)

Set the given key if it doesn't exist.

Parameters

string $key
string $value

Return Value

int

int hmget(string $key, dynamic $dictionary)

Get the value of the given hash fields.

Parameters

string $key
dynamic $dictionary

Return Value

int

int hmset(string $key, dynamic $dictionary)

Set the given hash fields to their respective values.

Parameters

string $key
dynamic $dictionary

Return Value

int

int hsetnx(string $hash, string $key, string $value)

Set the given hash field if it doesn't exist.

Parameters

string $hash
string $key
string $value

Return Value

int

int|false lrem(string $key, int $count, $value)

Removes the first count occurrences of the value element from the list.

Parameters

string $key
int $count
$value $value

Return Value

int|false

mixed|false spop(string $key, int|null $count = null)

Removes and returns a random element from the set value at key.

Parameters

string $key
int|null $count

Return Value

mixed|false

int zadd(string $key, dynamic $dictionary)

Add one or more members to a sorted set or update its score if it already exists.

Parameters

string $key
dynamic $dictionary

Return Value

int

int zrangebyscore(string $key, mixed $min, mixed $max, array $options = [])

Return elements with score between $min and $max.

Parameters

string $key
mixed $min
mixed $max
array $options

Return Value

int

int zrevrangebyscore(string $key, mixed $min, mixed $max, array $options = [])

Return elements with score between $min and $max.

Parameters

string $key
mixed $min
mixed $max
array $options

Return Value

int

int zinterstore(string $output, array $keys, array $options = [])

Find the intersection between sets and store in a new set.

Parameters

string $output
array $keys
array $options

Return Value

int

int zunionstore(string $output, array $keys, array $options = [])

Find the union between sets and store in a new set.

Parameters

string $output
array $keys
array $options

Return Value

int

Redis|array pipeline(callable $callback = null)

Execute commands in a pipeline.

Parameters

callable $callback

Return Value

Redis|array

Redis|array transaction(callable $callback = null)

Execute commands in a transaction.

Parameters

callable $callback

Return Value

Redis|array

mixed evalsha(string $script, int $numkeys, mixed $arguments)

Evaluate a LUA script serverside, from the SHA1 hash of the script instead of the script itself.

Parameters

string $script
int $numkeys
mixed $arguments

Return Value

mixed

mixed eval(string $script, int $numberOfKeys, dynamic $arguments)

Evaluate a script and return its result.

Parameters

string $script
int $numberOfKeys
dynamic $arguments

Return Value

mixed

mixed executeRaw(array $parameters)

Execute a raw command.

Parameters

array $parameters

Return Value

mixed

void disconnect()

Disconnects from the Redis instance.

Return Value

void

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.6/Illuminate/Redis/Connections/PhpRedisConnection.html