PHP Class Predis\PubSub\AbstractConsumer

Author: Daniele Alessandri ([email protected])
Inheritance: implements Iterator
Mostra file Open project: tillkruss/redis-object-cache

Public Methods

Method Description
__destruct ( ) Automatically stops the consumer when the garbage collector kicks in.
current ( ) : array Returns the last message payload retrieved from the server and generated by one of the active subscriptions.
key ( )
next ( )
ping ( string $payload = null ) PING the server with an optional payload that will be echoed as a PONG message in the pub/sub loop.
psubscribe ( $pattern ) Subscribes to the specified channels using a pattern.
punsubscribe ( ) Unsubscribes from the specified channels using a pattern.
rewind ( )
stop ( boolean $drop = false ) : boolean Closes the context by unsubscribing from all the subscribed channels. The context can be forcefully closed by dropping the underlying connection.
subscribe ( $channel ) Subscribes to the specified channels.
unsubscribe ( ) Unsubscribes from the specified channels.
valid ( ) : boolean Checks if the the consumer is still in a valid state to continue.

Protected Methods

Method Description
disconnect ( ) Closes the underlying connection when forcing a disconnection.
getValue ( ) : array Waits for a new message from the server generated by one of the active subscriptions and returns it when available.
invalidate ( ) Resets the state of the consumer.
isFlagSet ( integer $value ) : boolean Checks if the specified flag is valid based on the state of the consumer.
writeRequest ( string $method, array $arguments ) Writes a Redis command on the underlying connection.

Method Details

__destruct() public method

Automatically stops the consumer when the garbage collector kicks in.
public __destruct ( )

current() public method

Returns the last message payload retrieved from the server and generated by one of the active subscriptions.
public current ( ) : array
return array

disconnect() abstract protected method

Closes the underlying connection when forcing a disconnection.
abstract protected disconnect ( )

getValue() abstract protected method

Waits for a new message from the server generated by one of the active subscriptions and returns it when available.
abstract protected getValue ( ) : array
return array

invalidate() protected method

Resets the state of the consumer.
protected invalidate ( )

isFlagSet() protected method

Checks if the specified flag is valid based on the state of the consumer.
protected isFlagSet ( integer $value ) : boolean
$value integer Flag.
return boolean

key() public method

public key ( )

next() public method

public next ( )

ping() public method

PING the server with an optional payload that will be echoed as a PONG message in the pub/sub loop.
public ping ( string $payload = null )
$payload string Optional PING payload.

psubscribe() public method

Subscribes to the specified channels using a pattern.
public psubscribe ( $pattern )

punsubscribe() public method

Unsubscribes from the specified channels using a pattern.
public punsubscribe ( )

rewind() public method

public rewind ( )

stop() public method

Closes the context by unsubscribing from all the subscribed channels. The context can be forcefully closed by dropping the underlying connection.
public stop ( boolean $drop = false ) : boolean
$drop boolean Indicates if the context should be closed by dropping the connection.
return boolean Returns false when there are no pending messages.

subscribe() public method

Subscribes to the specified channels.
public subscribe ( $channel )

unsubscribe() public method

Unsubscribes from the specified channels.
public unsubscribe ( )

valid() public method

Checks if the the consumer is still in a valid state to continue.
public valid ( ) : boolean
return boolean

writeRequest() abstract protected method

Writes a Redis command on the underlying connection.
abstract protected writeRequest ( string $method, array $arguments )
$method string Command ID.
$arguments array Arguments for the command.