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 39
__construct(Container $app, PoolManager $poolManager, RedisConfig $config, RedisSentinelFactory $sentinelFactory)
Create a new Redis manager instance.
at line 50
RedisProxy
connection(UnitEnum|string|null $name = null)
Get a Redis connection by name.
at line 83
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.
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.
Existing pools with a different snapshotted setting are replaced; borrowed connections from the old generation are destroyed on release.
at line 146
void
disableEvents()
Disable Redis command events.
Existing pools with a different snapshotted setting are replaced; borrowed connections from the old generation are destroyed on release.
at line 158
protected void
refreshEventPools(bool $eventsEnabled)
Refresh pools whose command-event setting differs from the worker override.
Flushes shared pools that concurrent coroutines may be using.
at line 177
void
releaseConnections()
| internal |
Release connections retained by non-coroutine task execution.
at line 191
void
discardConnections()
| internal |
Discard connections retained by this manager.
at line 205
protected void
terminateConnections(Closure $terminate)
Terminate every created connection proxy.
at line 228
void
listen(Closure $callback)
Register a Redis command listener with the connection.
The listener persists on the singleton event dispatcher for the worker lifetime and runs for every subsequent Redis command event.
at line 242
void
listenForFailures(Closure $callback)
Register a Redis command failure listener with the connection.
The listener persists on the singleton event dispatcher for the worker lifetime and runs for every subsequent Redis failure event.
at line 253
void
subscribe(array|string $channels, Closure $callback)
Subscribe to a set of given channels for messages.
at line 261
void
psubscribe(array|string $channels, Closure $callback)
Subscribe to a set of given channels with wildcards.
at line 269
mixed
command(string $method, array $parameters = [])
Run a command against the Redis database.
at line 277
DurationLimiterBuilder
throttle(string $name)
Throttle a callback for a maximum number of executions over a given duration.
at line 285
ConcurrencyLimiterBuilder
funnel(string $name)
Funnel a callback for a maximum number of simultaneous executions.
at line 293
mixed
__call(string $method, array $parameters)
Pass methods onto the default Redis connection.