CursorBasedIterator
in package
implements
Iterator
Provides the base implementation for a fully-rewindable PHP iterator that can incrementally iterate over cursor-based collections stored on Redis using the commands in the `SCAN` family.
Given their incremental nature with multiple fetches, these kind of iterators offer limited guarantees about the returned elements because the collection can change several times during the iteration process.
Tags
Interfaces, Classes and Traits
- Iterator
Table of Contents
- $client : mixed
- $count : mixed
- $current : mixed
- $cursor : mixed
- $elements : mixed
- $fetchmore : mixed
- $match : 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.
- getScanOptions() : array<string|int, mixed>
- Returns an array of options for the `SCAN` command.
- requiredCommand() : mixed
- Ensures that the client 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
$cursor
protected
mixed
$cursor
$elements
protected
mixed
$elements
$fetchmore
protected
mixed
$fetchmore
$match
protected
mixed
$match
$position
protected
mixed
$position
$valid
protected
mixed
$valid
Methods
__construct()
public
__construct(ClientInterface $client[, string $match = null ][, int $count = null ]) : mixed
Parameters
- $client : ClientInterface
-
Client connected to Redis.
- $match : string = null
-
Pattern to match during the server-side iteration.
- $count : int = null
-
Hint used by Redis to compute the number of results per iteration.
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
abstract 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 —getScanOptions()
Returns an array of options for the `SCAN` command.
protected
getScanOptions() : array<string|int, mixed>
Return values
array<string|int, mixed> —requiredCommand()
Ensures that the client 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