ListKey
in package
implements
Iterator
Abstracts the iteration of items stored in a list by leveraging the LRANGE command wrapped in a fully-rewindable PHP iterator.
This iterator tries to emulate the behaviour of cursor-based iterators based on the SCAN-family of commands introduced in Redis <= 2.8, meaning that due to its incremental nature with multiple fetches it can only offer limited guarantees on the returned elements because the collection can change several times (trimmed, deleted, overwritten) during the iteration process.
Tags
Interfaces, Classes and Traits
- Iterator
Table of Contents
- $client : mixed
- $count : mixed
- $current : mixed
- $elements : mixed
- $fetchmore : mixed
- $key : mixed
- $position : mixed
- $valid : mixed
- __construct() : mixed
- current() : mixed
- {@inheritdoc}
- key() : mixed
- {@inheritdoc}
- next() : mixed
- {@inheritdoc}
- rewind() : mixed
- {@inheritdoc}
- valid() : mixed
- {@inheritdoc}
- executeCommand() : array<string|int, mixed>
- Fetches a new set of elements from the remote collection, effectively advancing the iteration process.
- extractNext() : mixed
- Extracts next values for key() and current().
- fetch() : mixed
- Populates the local buffer of elements fetched from the server during the iteration.
- requiredCommand() : mixed
- Ensures that the client instance supports the specified Redis command required to fetch elements from the server to perform the iteration.
- reset() : mixed
- Resets the inner state of the iterator.
Properties
$client
protected
mixed
$client
$count
protected
mixed
$count
$current
protected
mixed
$current
$elements
protected
mixed
$elements
$fetchmore
protected
mixed
$fetchmore
$key
protected
mixed
$key
$position
protected
mixed
$position
$valid
protected
mixed
$valid
Methods
__construct()
public
__construct(ClientInterface $client, string $key[, int $count = 10 ]) : mixed
Parameters
- $client : ClientInterface
-
Client connected to Redis.
- $key : string
-
Redis list key.
- $count : int = 10
-
Number of items retrieved on each fetch operation.
Tags
Return values
mixed —current()
{@inheritdoc}
public
current() : mixed
Return values
mixed —key()
{@inheritdoc}
public
key() : mixed
Return values
mixed —next()
{@inheritdoc}
public
next() : mixed
Return values
mixed —rewind()
{@inheritdoc}
public
rewind() : mixed
Return values
mixed —valid()
{@inheritdoc}
public
valid() : mixed
Return values
mixed —executeCommand()
Fetches a new set of elements from the remote collection, effectively advancing the iteration process.
protected
executeCommand() : array<string|int, mixed>
Return values
array<string|int, mixed> —extractNext()
Extracts next values for key() and current().
protected
extractNext() : mixed
Return values
mixed —fetch()
Populates the local buffer of elements fetched from the server during the iteration.
protected
fetch() : mixed
Return values
mixed —requiredCommand()
Ensures that the client instance supports the specified Redis command required to fetch elements from the server to perform the iteration.
protected
requiredCommand(ClientInterface $client, string $commandID) : mixed
Parameters
- $client : ClientInterface
-
Client connected to Redis.
- $commandID : string
-
Command ID.
Tags
Return values
mixed —reset()
Resets the inner state of the iterator.
protected
reset() : mixed