DispatcherLoop
in package
Method-dispatcher loop built around the client-side abstraction of a Redis PUB / SUB context.
Tags
Table of Contents
- $callbacks : mixed
- $defaultCallback : mixed
- $subscriptionCallback : mixed
- $pubsub : mixed
- __construct() : mixed
- attachCallback() : mixed
- Binds a callback to a channel.
- defaultCallback() : mixed
- Sets a callback that gets invoked when a message is received on a channel that does not have an associated callback.
- detachCallback() : mixed
- Stops listening to a channel and removes the associated callback.
- getPubSubConsumer() : Consumer
- Returns the underlying PUB / SUB context.
- run() : mixed
- Starts the dispatcher loop.
- stop() : mixed
- Terminates the dispatcher loop.
- subscriptionCallback() : mixed
- Sets a callback that gets invoked upon new subscriptions.
- assertCallback() : mixed
- Checks if the passed argument is a valid callback.
- getPrefixKeys() : string
- Return the prefix used for keys.
Properties
$callbacks
protected
mixed
$callbacks
$defaultCallback
protected
mixed
$defaultCallback
$subscriptionCallback
protected
mixed
$subscriptionCallback
$pubsub
private
mixed
$pubsub
Methods
__construct()
public
__construct(Consumer $pubsub) : mixed
Parameters
- $pubsub : Consumer
-
PubSub consumer instance used by the loop.
Return values
mixed —attachCallback()
Binds a callback to a channel.
public
attachCallback(string $channel, callable $callback) : mixed
Parameters
- $channel : string
-
Channel name.
- $callback : callable
-
A callback.
Return values
mixed —defaultCallback()
Sets a callback that gets invoked when a message is received on a channel that does not have an associated callback.
public
defaultCallback([mixed $callable = null ]) : mixed
Parameters
- $callable : mixed = null
-
A callback.
Return values
mixed —detachCallback()
Stops listening to a channel and removes the associated callback.
public
detachCallback(string $channel) : mixed
Parameters
- $channel : string
-
Redis channel.
Return values
mixed —getPubSubConsumer()
Returns the underlying PUB / SUB context.
public
getPubSubConsumer() : Consumer
Return values
Consumer —run()
Starts the dispatcher loop.
public
run() : mixed
Return values
mixed —stop()
Terminates the dispatcher loop.
public
stop() : mixed
Return values
mixed —subscriptionCallback()
Sets a callback that gets invoked upon new subscriptions.
public
subscriptionCallback([mixed $callable = null ]) : mixed
Parameters
- $callable : mixed = null
-
A callback.
Return values
mixed —assertCallback()
Checks if the passed argument is a valid callback.
protected
assertCallback(mixed $callable) : mixed
Parameters
- $callable : mixed
-
A callback.
Tags
Return values
mixed —getPrefixKeys()
Return the prefix used for keys.
protected
getPrefixKeys() : string