1
|
<?php
|
2
|
|
3
|
/*
|
4
|
* This file is part of the Predis package.
|
5
|
*
|
6
|
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
7
|
*
|
8
|
* For the full copyright and license information, please view the LICENSE
|
9
|
* file that was distributed with this source code.
|
10
|
*/
|
11
|
|
12
|
namespace Predis\Collection\Iterator;
|
13
|
|
14
|
use Predis\ClientInterface;
|
15
|
|
16
|
/**
|
17
|
* Abstracts the iteration of members stored in a set by
|
18
|
* leveraging the SSCAN command (Redis >= 2.8) wrapped in
|
19
|
* a fully-rewindable PHP iterator.
|
20
|
*
|
21
|
* @author Daniele Alessandri <suppakilla@gmail.com>
|
22
|
* @link http://redis.io/commands/scan
|
23
|
*/
|
24
|
class SetKey extends CursorBasedIterator
|
25
|
{
|
26
|
protected $key;
|
27
|
|
28
|
/**
|
29
|
* {@inheritdoc}
|
30
|
*/
|
31
|
public function __construct(ClientInterface $client, $key, $match = null, $count = null)
|
32
|
{
|
33
|
$this->requiredCommand($client, 'SSCAN');
|
34
|
|
35
|
parent::__construct($client, $match, $count);
|
36
|
|
37
|
$this->key = $key;
|
38
|
}
|
39
|
|
40
|
/**
|
41
|
* {@inheritdoc}
|
42
|
*/
|
43
|
protected function executeCommand()
|
44
|
{
|
45
|
return $this->client->sscan($this->key, $this->cursor, $this->getScanOptions());
|
46
|
}
|
47
|
}
|