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.
Refresh pools whose command-event setting differs from the worker override.
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 38
__construct(Container $app, PoolManager $poolManager, RedisConfig $config, RedisSentinelFactory $sentinelFactory)
Create a new Redis manager instance.
at line 49
RedisProxy
connection(UnitEnum|string|null $name = null)
Get a Redis connection by name.
at line 82
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 122
array
connections()
Return all of the created connections.
at line 133
void
enableEvents()
Enable Redis command events.
Boot-only. Existing pools with a different snapshotted setting are replaced; borrowed connections from the old generation are destroyed on release.
at line 145
void
disableEvents()
Disable Redis command events.
Boot-only. Existing pools with a different snapshotted setting are replaced; borrowed connections from the old generation are destroyed on release.
at line 154
protected void
refreshEventPools(bool $eventsEnabled)
Refresh pools whose command-event setting differs from the worker override.
at line 172
void
releaseConnections()
| internal |
Release connections retained by non-coroutine task execution.
at line 186
void
discardConnections()
| internal |
Discard connections retained by this manager.
at line 200
protected void
terminateConnections(Closure $terminate)
Terminate every created connection proxy.
at line 225
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 238
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 248
void
subscribe(array|string $channels, Closure $callback)
Subscribe to a set of given channels for messages.
at line 256
void
psubscribe(array|string $channels, Closure $callback)
Subscribe to a set of given channels with wildcards.
at line 264
mixed
command(string $method, array $parameters = [])
Run a command against the Redis database.
at line 272
DurationLimiterBuilder
throttle(string $name)
Throttle a callback for a maximum number of executions over a given duration.
at line 280
ConcurrencyLimiterBuilder
funnel(string $name)
Funnel a callback for a maximum number of simultaneous executions.
at line 288
mixed
__call(string $method, array $parameters)
Pass methods onto the default Redis connection.