RedisManager
class RedisManager implements Factory, Connection mixin RedisProxy
Properties
| protected RedisProxy> | $connections | The resolved connection proxies. |
Methods
Create a new Redis manager instance.
Get a Redis connection by name.
Disconnect the given connection and remove from local cache.
Return all of the created connections.
Enable Redis command events.
Disable Redis command events.
Release connections retained by non-coroutine task execution.
Discard connections retained by this manager.
Subscribe to a set of given channels with wildcards.
Run a command against the Redis database.
Throttle a callback for a maximum number of executions over a given duration.
Funnel a callback for a maximum number of simultaneous executions.
Pass methods onto the default Redis connection.
Details
at line 37
__construct(Container $app, PoolFactory $factory, RedisConfig $config, RedisSentinelFactory $sentinelFactory)
Create a new Redis manager instance.
at line 48
RedisProxy
connection(UnitEnum|string|null $name = null)
Get a Redis connection by name.
at line 81
void
purge(UnitEnum|string|null $name = null)
Disconnect the given connection and remove from local cache.
Discards any context-pinned connection and flushes the underlying pool so all connections are closed and re-created on next use.
Boot or tests only. Flushes the shared pool; concurrent coroutines checked out before this call may complete against the destroyed pool and other coroutines lose their cached proxy reference.
at line 119
array
connections()
Return all of the created connections.
at line 130
void
enableEvents()
Enable Redis command events.
Boot-only. Existing pools retain their snapshotted event configuration; calling this after pool creation can leave generations with different behavior.
at line 141
void
disableEvents()
Disable Redis command events.
Boot-only. Existing pools retain their snapshotted event configuration; calling this after pool creation can leave generations with different behavior.
at line 153
void
releaseConnections()
| internal |
Release connections retained by non-coroutine task execution.
at line 167
void
discardConnections()
| internal |
Discard connections retained by this manager.
at line 181
protected void
terminateConnections(Closure $terminate)
Terminate every created connection proxy.
at line 204
void
listen(Closure $callback)
Register a Redis command listener with the connection.
Boot-only. The listener persists on the singleton event dispatcher for the worker lifetime and runs for every subsequent Redis command event.
at line 217
void
listenForFailures(Closure $callback)
Register a Redis command failure listener with the connection.
Boot-only. The listener persists on the singleton event dispatcher for the worker lifetime and runs for every subsequent Redis failure event.
at line 227
void
subscribe(array|string $channels, Closure $callback)
Subscribe to a set of given channels for messages.
at line 235
void
psubscribe(array|string $channels, Closure $callback)
Subscribe to a set of given channels with wildcards.
at line 243
mixed
command(string $method, array $parameters = [])
Run a command against the Redis database.
at line 251
DurationLimiterBuilder
throttle(string $name)
Throttle a callback for a maximum number of executions over a given duration.
at line 259
ConcurrencyLimiterBuilder
funnel(string $name)
Funnel a callback for a maximum number of simultaneous executions.
at line 267
mixed
__call(string $method, array $parameters)
Pass methods onto the default Redis connection.