class CommandInvoker

Constants

private MESSAGE_PUSH_TIMEOUT

Properties

protected Channel $resultChannel
protected Channel $messageChannel

Methods

__construct(Connection $connection, StdoutLoggerInterface|null $logger = null, float $timeout = 5.0)

Create a new Redis subscriber command invoker.

array
invoke(int|string|array|null $command, int $number)

Invoke a Redis subscriber command.

channel()

Get the subscriber message channel.

bool
interrupt()

Interrupt the subscriber connection.

string|bool
ping(float $timeout = 1)

Ping the Redis subscriber connection.

void
receive(Connection $connection)

Receive Redis subscriber responses.

void
watchForShutdown()

Watch for worker shutdown and interrupt the connection.

void
loop()

Start the Redis subscriber receive loop.

Details

at line 35
__construct(Connection $connection, StdoutLoggerInterface|null $logger = null, float $timeout = 5.0)

Create a new Redis subscriber command invoker.

Parameters

Connection $connection
StdoutLoggerInterface|null $logger
float $timeout

at line 62
array invoke(int|string|array|null $command, int $number)

Invoke a Redis subscriber command.

Parameters

int|string|array|null $command
int $number

Return Value

array

at line 118
Channel channel()

Get the subscriber message channel.

Return Value

Channel

at line 126
bool interrupt()

Interrupt the subscriber connection.

Return Value

bool

at line 153
string|bool ping(float $timeout = 1)

Ping the Redis subscriber connection.

Parameters

float $timeout

Return Value

string|bool

at line 198
protected void receive(Connection $connection)

Receive Redis subscriber responses.

Parameters

Connection $connection

Return Value

void

at line 358
protected void watchForShutdown()

Watch for worker shutdown and interrupt the connection.

Without this, the receive loop's socket recv blocks indefinitely and Swoole's coroutine scheduler cannot detect the deadlock (active I/O keeps the event loop alive). This provides a deterministic shutdown path that doesn't depend on coroutine scheduling order.

Return Value

void

at line 368
protected void loop()

Start the Redis subscriber receive loop.

Return Value

void