Procházet zdrojové kódy

Rename for the last time all the iterator classes.

We are experimenting with a new approach at naming classes using less
redundant names by leveraging the containing namespace. The PHP "use"
directive is not limited to class names but can be used to import the
whole namespace, which means you can do something like this:

  use Predis\Collection\Iterator;
  // ...
  foreach (new Iterator\Keyspace($client) as $key) {
  	// ...
  }

Alternatively you can always rely on "use ... as ..." to import one of
the classes by giving it a more meaningful name in the context of the
root namespace:

  use Predis\Collection\Iterator\Keyspace as KeyspaceIterator;
  // ...
  foreach (new KeyspaceIterator($client) as $key) {
  	// ...
  }

In this specific case we chose to apply the -Key postfix to classes
iterating Redis keys to be more explicit about the fact that those
iterators does not work on local in-memory collections, but fetch
items from a key stored on a remote Redis server.
Daniele Alessandri před 11 roky
rodič
revize
5ad00774e1

+ 9 - 12
examples/RedisCollectionsIterators.php

@@ -11,10 +11,7 @@
 
 require 'SharedConfigurations.php';
 
-use Predis\Collection\Iterator\KeyspaceIterator;
-use Predis\Collection\Iterator\SetIterator;
-use Predis\Collection\Iterator\SortedSetIterator;
-use Predis\Collection\Iterator\HashIterator;
+use Predis\Collection\Iterator;
 
 // Redis 2.8 features new commands allowing clients to incrementally
 // iterate over collections without blocking the server like it happens
@@ -40,9 +37,9 @@ for ($i = 0; $i < 5; $i++) {
     $client->hset('predis:hash', "field:$i", "value:$i");
 }
 
-// === KeyspaceIterator based on SCAN ===
+// === Keyspace iterator based on SCAN ===
 echo 'Scan the keyspace matching only our prefixed keys:' . PHP_EOL;
-foreach (new KeyspaceIterator($client, 'predis:*') as $key) {
+foreach (new Iterator\Keyspace($client, 'predis:*') as $key) {
     echo " - $key" . PHP_EOL;
 }
 
@@ -53,9 +50,9 @@ Scan the keyspace matching only our prefixed keys:
  - predis:hash
 */
 
-// === SetIterator class based on SSCAN ===
+// === Set iterator based on SSCAN ===
 echo 'Scan members of `predis:set`:' . PHP_EOL;
-foreach (new SetIterator($client, 'predis:set') as $member) {
+foreach (new Iterator\SetKey($client, 'predis:set') as $member) {
     echo " - $member" . PHP_EOL;
 }
 
@@ -68,9 +65,9 @@ Scan members of `predis:set`:
  - member:2
 */
 
-// === SortedSetIterator class based on ZSCAN ===
+// === Sorted set iterator based on ZSCAN ===
 echo 'Scan members and ranks of `predis:zset`:' . PHP_EOL;
-foreach (new SortedSetIterator($client, 'predis:zset') as $member => $rank) {
+foreach (new Iterator\SortedSetKey($client, 'predis:zset') as $member => $rank) {
     echo " - $member [rank: $rank]" . PHP_EOL;
 }
 
@@ -83,9 +80,9 @@ Scan members and ranks of `predis:zset`:
  - member:0 [rank: 0]
 */
 
-// === HashIterator class based on HSCAN ===
+// === Hash iterator based on HSCAN ===
 echo 'Scan fields and values of `predis:hash`:' . PHP_EOL;
-foreach (new HashIterator($client, 'predis:hash') as $field => $value) {
+foreach (new Iterator\HashKey($client, 'predis:hash') as $field => $value) {
     echo " - $field => $value" . PHP_EOL;
 }
 

+ 1 - 1
lib/Predis/Collection/Iterator/RedisCollectionIterator.php → lib/Predis/Collection/Iterator/CursorBasedIterator.php

@@ -25,7 +25,7 @@ use Predis\NotSupportedException;
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-abstract class RedisCollectionIterator implements Iterator
+abstract class CursorBasedIterator implements Iterator
 {
     protected $client;
     protected $match;

+ 1 - 1
lib/Predis/Collection/Iterator/HashIterator.php → lib/Predis/Collection/Iterator/HashKey.php

@@ -21,7 +21,7 @@ use Predis\ClientInterface;
  * @author Daniele Alessandri <suppakilla@gmail.com>
  * @link http://redis.io/commands/scan
  */
-class HashIterator extends RedisCollectionIterator
+class HashKey extends CursorBasedIterator
 {
     protected $key;
 

+ 1 - 1
lib/Predis/Collection/Iterator/KeyspaceIterator.php → lib/Predis/Collection/Iterator/Keyspace.php

@@ -21,7 +21,7 @@ use Predis\ClientInterface;
  * @author Daniele Alessandri <suppakilla@gmail.com>
  * @link http://redis.io/commands/scan
  */
-class KeyspaceIterator extends RedisCollectionIterator
+class Keyspace extends CursorBasedIterator
 {
     /**
      * {@inheritdoc}

+ 1 - 1
lib/Predis/Collection/Iterator/SetIterator.php → lib/Predis/Collection/Iterator/SetKey.php

@@ -21,7 +21,7 @@ use Predis\ClientInterface;
  * @author Daniele Alessandri <suppakilla@gmail.com>
  * @link http://redis.io/commands/scan
  */
-class SetIterator extends RedisCollectionIterator
+class SetKey extends CursorBasedIterator
 {
     protected $key;
 

+ 1 - 1
lib/Predis/Collection/Iterator/SortedSetIterator.php → lib/Predis/Collection/Iterator/SortedSetKey.php

@@ -21,7 +21,7 @@ use Predis\ClientInterface;
  * @author Daniele Alessandri <suppakilla@gmail.com>
  * @link http://redis.io/commands/scan
  */
-class SortedSetIterator extends RedisCollectionIterator
+class SortedSetKey extends CursorBasedIterator
 {
     protected $key;
 

+ 14 - 14
tests/Predis/Collection/Iterator/HashIteratorTest.php → tests/Predis/Collection/Iterator/HashKeyTest.php

@@ -19,7 +19,7 @@ use Predis\Profile\ServerProfile;
 /**
  * @group realm-iterators
  */
-class HashIteratorTest extends StandardTestCase
+class HashKeyTest extends StandardTestCase
 {
     /**
      * @group disconnected
@@ -34,7 +34,7 @@ class HashIteratorTest extends StandardTestCase
                ->method('getProfile')
                ->will($this->returnValue(ServerProfile::get('2.0')));
 
-        $iterator = new HashIterator($client, 'key:hash');
+        $iterator = new HashKey($client, 'key:hash');
     }
 
     /**
@@ -52,7 +52,7 @@ class HashIteratorTest extends StandardTestCase
                ->with('key:hash', 0, array())
                ->will($this->returnValue(array(0, array())));
 
-        $iterator = new HashIterator($client, 'key:hash');
+        $iterator = new HashKey($client, 'key:hash');
 
         $iterator->rewind();
         $this->assertFalse($iterator->valid());
@@ -75,7 +75,7 @@ class HashIteratorTest extends StandardTestCase
                     'field:1st' => 'value:1st', 'field:2nd' => 'value:2nd', 'field:3rd' => 'value:3rd',
                ))));
 
-        $iterator = new HashIterator($client, 'key:hash');
+        $iterator = new HashKey($client, 'key:hash');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -119,7 +119,7 @@ class HashIteratorTest extends StandardTestCase
                     'field:3rd' => 'value:3rd',
                ))));
 
-        $iterator = new HashIterator($client, 'key:hash');
+        $iterator = new HashKey($client, 'key:hash');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -161,7 +161,7 @@ class HashIteratorTest extends StandardTestCase
                     'field:1st' => 'value:1st', 'field:2nd' => 'value:2nd',
                ))));
 
-        $iterator = new HashIterator($client, 'key:hash');
+        $iterator = new HashKey($client, 'key:hash');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -204,7 +204,7 @@ class HashIteratorTest extends StandardTestCase
                     'field:3rd' => 'value:3rd',
                ))));
 
-        $iterator = new HashIterator($client, 'key:hash');
+        $iterator = new HashKey($client, 'key:hash');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -242,7 +242,7 @@ class HashIteratorTest extends StandardTestCase
                     'field:1st' => 'value:1st', 'field:2nd' => 'value:2nd',
                ))));
 
-        $iterator = new HashIterator($client, 'key:hash', 'field:*');
+        $iterator = new HashKey($client, 'key:hash', 'field:*');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -281,7 +281,7 @@ class HashIteratorTest extends StandardTestCase
                     'field:2nd' => 'value:2nd',
                 ))));
 
-        $iterator = new HashIterator($client, 'key:hash', 'field:*');
+        $iterator = new HashKey($client, 'key:hash', 'field:*');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -314,7 +314,7 @@ class HashIteratorTest extends StandardTestCase
                     'field:1st' => 'value:1st', 'field:2nd' => 'value:2nd',
                ))));
 
-        $iterator = new HashIterator($client, 'key:hash', null, 2);
+        $iterator = new HashKey($client, 'key:hash', null, 2);
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -353,7 +353,7 @@ class HashIteratorTest extends StandardTestCase
                     'field:2nd' => 'value:2nd',
                 ))));
 
-        $iterator = new HashIterator($client, 'key:hash', null, 1);
+        $iterator = new HashKey($client, 'key:hash', null, 1);
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -386,7 +386,7 @@ class HashIteratorTest extends StandardTestCase
                     'field:1st' => 'value:1st', 'field:2nd' => 'value:2nd',
                ))));
 
-        $iterator = new HashIterator($client, 'key:hash', 'field:*', 2);
+        $iterator = new HashKey($client, 'key:hash', 'field:*', 2);
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -425,7 +425,7 @@ class HashIteratorTest extends StandardTestCase
                     'field:2nd' => 'value:2nd',
                 ))));
 
-        $iterator = new HashIterator($client, 'key:hash', 'field:*', 1);
+        $iterator = new HashKey($client, 'key:hash', 'field:*', 1);
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -458,7 +458,7 @@ class HashIteratorTest extends StandardTestCase
                     'field:1st' => 'value:1st', 'field:2nd' => 'value:2nd',
                ))));
 
-        $iterator = new HashIterator($client, 'key:hash');
+        $iterator = new HashKey($client, 'key:hash');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());

+ 14 - 14
tests/Predis/Collection/Iterator/KeyspaceIteratorTest.php → tests/Predis/Collection/Iterator/KeyspaceTest.php

@@ -19,7 +19,7 @@ use Predis\Profile\ServerProfile;
 /**
  * @group realm-iterators
  */
-class KeyspaceIteratorTest extends StandardTestCase
+class KeyspaceTest extends StandardTestCase
 {
     /**
      * @group disconnected
@@ -34,7 +34,7 @@ class KeyspaceIteratorTest extends StandardTestCase
                ->method('getProfile')
                ->will($this->returnValue(ServerProfile::get('2.0')));
 
-        $iterator = new KeyspaceIterator($client);
+        $iterator = new Keyspace($client);
     }
 
     /**
@@ -52,7 +52,7 @@ class KeyspaceIteratorTest extends StandardTestCase
                ->with(0, array())
                ->will($this->returnValue(array(0, array())));
 
-        $iterator = new KeyspaceIterator($client);
+        $iterator = new Keyspace($client);
 
         $iterator->rewind();
         $this->assertFalse($iterator->valid());
@@ -73,7 +73,7 @@ class KeyspaceIteratorTest extends StandardTestCase
                ->with(0, array())
                ->will($this->returnValue(array(0, array('key:1st', 'key:2nd', 'key:3rd'))));
 
-        $iterator = new KeyspaceIterator($client);
+        $iterator = new Keyspace($client);
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -113,7 +113,7 @@ class KeyspaceIteratorTest extends StandardTestCase
                ->with(2, array())
                ->will($this->returnValue(array(0, array('key:3rd'))));
 
-        $iterator = new KeyspaceIterator($client);
+        $iterator = new Keyspace($client);
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -153,7 +153,7 @@ class KeyspaceIteratorTest extends StandardTestCase
                ->with(4, array())
                ->will($this->returnValue(array(0, array('key:1st', 'key:2nd'))));
 
-        $iterator = new KeyspaceIterator($client);
+        $iterator = new Keyspace($client);
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -192,7 +192,7 @@ class KeyspaceIteratorTest extends StandardTestCase
                ->with(5, array())
                ->will($this->returnValue(array(0, array('key:3rd'))));
 
-        $iterator = new KeyspaceIterator($client);
+        $iterator = new Keyspace($client);
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -228,7 +228,7 @@ class KeyspaceIteratorTest extends StandardTestCase
                ->with(0, array('MATCH' => 'key:*'))
                ->will($this->returnValue(array(0, array('key:1st', 'key:2nd'))));
 
-        $iterator = new KeyspaceIterator($client, 'key:*');
+        $iterator = new Keyspace($client, 'key:*');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -263,7 +263,7 @@ class KeyspaceIteratorTest extends StandardTestCase
                ->with(1, array('MATCH' => 'key:*'))
                ->will($this->returnValue(array(0, array('key:2nd'))));
 
-        $iterator = new KeyspaceIterator($client, 'key:*');
+        $iterator = new Keyspace($client, 'key:*');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -294,7 +294,7 @@ class KeyspaceIteratorTest extends StandardTestCase
                ->with(0, array('COUNT' => 2))
                ->will($this->returnValue(array(0, array('key:1st', 'key:2nd'))));
 
-        $iterator = new KeyspaceIterator($client, null, 2);
+        $iterator = new Keyspace($client, null, 2);
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -329,7 +329,7 @@ class KeyspaceIteratorTest extends StandardTestCase
                ->with(1, array('COUNT' => 1))
                ->will($this->returnValue(array(0, array('key:2nd'))));
 
-        $iterator = new KeyspaceIterator($client, null, 1);
+        $iterator = new Keyspace($client, null, 1);
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -360,7 +360,7 @@ class KeyspaceIteratorTest extends StandardTestCase
                ->with(0, array('MATCH' => 'key:*', 'COUNT' => 2))
                ->will($this->returnValue(array(0, array('key:1st', 'key:2nd'))));
 
-        $iterator = new KeyspaceIterator($client, 'key:*', 2);
+        $iterator = new Keyspace($client, 'key:*', 2);
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -395,7 +395,7 @@ class KeyspaceIteratorTest extends StandardTestCase
                ->with(1, array('MATCH' => 'key:*', 'COUNT' => 1))
                ->will($this->returnValue(array(0, array('key:2nd'))));
 
-        $iterator = new KeyspaceIterator($client, 'key:*', 1);
+        $iterator = new Keyspace($client, 'key:*', 1);
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -426,7 +426,7 @@ class KeyspaceIteratorTest extends StandardTestCase
                ->with(0, array())
                ->will($this->returnValue(array(0, array('key:1st', 'key:2nd'))));
 
-        $iterator = new KeyspaceIterator($client);
+        $iterator = new Keyspace($client);
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());

+ 14 - 14
tests/Predis/Collection/Iterator/SetIteratorTest.php → tests/Predis/Collection/Iterator/SetKeyTest.php

@@ -19,7 +19,7 @@ use Predis\Profile\ServerProfile;
 /**
  * @group realm-iterators
  */
-class SetIteratorTest extends StandardTestCase
+class SetKeyTest extends StandardTestCase
 {
     /**
      * @group disconnected
@@ -34,7 +34,7 @@ class SetIteratorTest extends StandardTestCase
                ->method('getProfile')
                ->will($this->returnValue(ServerProfile::get('2.0')));
 
-        $iterator = new SetIterator($client, 'key:set');
+        $iterator = new SetKey($client, 'key:set');
     }
 
     /**
@@ -52,7 +52,7 @@ class SetIteratorTest extends StandardTestCase
                ->with('key:set', 0, array())
                ->will($this->returnValue(array(0, array())));
 
-        $iterator = new SetIterator($client, 'key:set');
+        $iterator = new SetKey($client, 'key:set');
 
         $iterator->rewind();
         $this->assertFalse($iterator->valid());
@@ -73,7 +73,7 @@ class SetIteratorTest extends StandardTestCase
                ->with('key:set', 0, array())
                ->will($this->returnValue(array(0, array('member:1st', 'member:2nd', 'member:3rd'))));
 
-        $iterator = new SetIterator($client, 'key:set');
+        $iterator = new SetKey($client, 'key:set');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -113,7 +113,7 @@ class SetIteratorTest extends StandardTestCase
                ->with('key:set', 2, array())
                ->will($this->returnValue(array(0, array('member:3rd'))));
 
-        $iterator = new SetIterator($client, 'key:set');
+        $iterator = new SetKey($client, 'key:set');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -153,7 +153,7 @@ class SetIteratorTest extends StandardTestCase
                ->with('key:set', 4, array())
                ->will($this->returnValue(array(0, array('member:1st', 'member:2nd'))));
 
-        $iterator = new SetIterator($client, 'key:set');
+        $iterator = new SetKey($client, 'key:set');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -192,7 +192,7 @@ class SetIteratorTest extends StandardTestCase
                ->with('key:set', 5, array())
                ->will($this->returnValue(array(0, array('member:3rd'))));
 
-        $iterator = new SetIterator($client, 'key:set');
+        $iterator = new SetKey($client, 'key:set');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -228,7 +228,7 @@ class SetIteratorTest extends StandardTestCase
                ->with('key:set', 0, array('MATCH' => 'member:*'))
                ->will($this->returnValue(array(0, array('member:1st', 'member:2nd'))));
 
-        $iterator = new SetIterator($client, 'key:set', 'member:*');
+        $iterator = new SetKey($client, 'key:set', 'member:*');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -263,7 +263,7 @@ class SetIteratorTest extends StandardTestCase
                ->with('key:set', 1, array('MATCH' => 'member:*'))
                ->will($this->returnValue(array(0, array('member:2nd'))));
 
-        $iterator = new SetIterator($client, 'key:set', 'member:*');
+        $iterator = new SetKey($client, 'key:set', 'member:*');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -294,7 +294,7 @@ class SetIteratorTest extends StandardTestCase
                ->with('key:set', 0, array('COUNT' => 2))
                ->will($this->returnValue(array(0, array('member:1st', 'member:2nd'))));
 
-        $iterator = new SetIterator($client, 'key:set', null, 2);
+        $iterator = new SetKey($client, 'key:set', null, 2);
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -329,7 +329,7 @@ class SetIteratorTest extends StandardTestCase
                ->with('key:set', 1, array('COUNT' => 1))
                ->will($this->returnValue(array(0, array('member:2nd'))));
 
-        $iterator = new SetIterator($client, 'key:set', null, 1);
+        $iterator = new SetKey($client, 'key:set', null, 1);
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -360,7 +360,7 @@ class SetIteratorTest extends StandardTestCase
                ->with('key:set', 0, array('MATCH' => 'member:*', 'COUNT' => 2))
                ->will($this->returnValue(array(0, array('member:1st', 'member:2nd'))));
 
-        $iterator = new SetIterator($client, 'key:set', 'member:*', 2);
+        $iterator = new SetKey($client, 'key:set', 'member:*', 2);
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -395,7 +395,7 @@ class SetIteratorTest extends StandardTestCase
                ->with('key:set', 1, array('MATCH' => 'member:*', 'COUNT' => 1))
                ->will($this->returnValue(array(0, array('member:2nd'))));
 
-        $iterator = new SetIterator($client, 'key:set', 'member:*', 1);
+        $iterator = new SetKey($client, 'key:set', 'member:*', 1);
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -426,7 +426,7 @@ class SetIteratorTest extends StandardTestCase
                ->with('key:set', 0, array())
                ->will($this->returnValue(array(0, array('member:1st', 'member:2nd'))));
 
-        $iterator = new SetIterator($client, 'key:set');
+        $iterator = new SetKey($client, 'key:set');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());

+ 14 - 14
tests/Predis/Collection/Iterator/SortedSetIteratorTest.php → tests/Predis/Collection/Iterator/SortedSetKeyTest.php

@@ -19,7 +19,7 @@ use Predis\Profile\ServerProfile;
 /**
  * @group realm-iterators
  */
-class SortedSetIteratorTest extends StandardTestCase
+class SortedSetTest extends StandardTestCase
 {
     /**
      * @group disconnected
@@ -34,7 +34,7 @@ class SortedSetIteratorTest extends StandardTestCase
                ->method('getProfile')
                ->will($this->returnValue(ServerProfile::get('2.0')));
 
-        $iterator = new SortedSetIterator($client, 'key:zset');
+        $iterator = new SortedSetKey($client, 'key:zset');
     }
 
     /**
@@ -52,7 +52,7 @@ class SortedSetIteratorTest extends StandardTestCase
                ->with('key:zset', 0, array())
                ->will($this->returnValue(array(0, array())));
 
-        $iterator = new SortedSetIterator($client, 'key:zset');
+        $iterator = new SortedSetKey($client, 'key:zset');
 
         $iterator->rewind();
         $this->assertFalse($iterator->valid());
@@ -75,7 +75,7 @@ class SortedSetIteratorTest extends StandardTestCase
                     array('member:1st', 1.0), array('member:2nd', 2.0), array('member:3rd', 3.0),
                ))));
 
-        $iterator = new SortedSetIterator($client, 'key:zset');
+        $iterator = new SortedSetKey($client, 'key:zset');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -119,7 +119,7 @@ class SortedSetIteratorTest extends StandardTestCase
                     array('member:3rd', 3.0),
                ))));
 
-        $iterator = new SortedSetIterator($client, 'key:zset');
+        $iterator = new SortedSetKey($client, 'key:zset');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -161,7 +161,7 @@ class SortedSetIteratorTest extends StandardTestCase
                     array('member:1st', 1.0), array('member:2nd', 2.0),
                ))));
 
-        $iterator = new SortedSetIterator($client, 'key:zset');
+        $iterator = new SortedSetKey($client, 'key:zset');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -204,7 +204,7 @@ class SortedSetIteratorTest extends StandardTestCase
                     array('member:3rd', 3.0)
                ))));
 
-        $iterator = new SortedSetIterator($client, 'key:zset');
+        $iterator = new SortedSetKey($client, 'key:zset');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -242,7 +242,7 @@ class SortedSetIteratorTest extends StandardTestCase
                     array('member:1st', 1.0), array('member:2nd', 2.0),
                ))));
 
-        $iterator = new SortedSetIterator($client, 'key:zset', 'member:*');
+        $iterator = new SortedSetKey($client, 'key:zset', 'member:*');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -281,7 +281,7 @@ class SortedSetIteratorTest extends StandardTestCase
                     array('member:2nd', 2.0),
                 ))));
 
-        $iterator = new SortedSetIterator($client, 'key:zset', 'member:*');
+        $iterator = new SortedSetKey($client, 'key:zset', 'member:*');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -314,7 +314,7 @@ class SortedSetIteratorTest extends StandardTestCase
                     array('member:1st', 1.0), array('member:2nd', 2.0),
                ))));
 
-        $iterator = new SortedSetIterator($client, 'key:zset', null, 2);
+        $iterator = new SortedSetKey($client, 'key:zset', null, 2);
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -353,7 +353,7 @@ class SortedSetIteratorTest extends StandardTestCase
                     array('member:2nd', 2.0),
                 ))));
 
-        $iterator = new SortedSetIterator($client, 'key:zset', null, 1);
+        $iterator = new SortedSetKey($client, 'key:zset', null, 1);
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -386,7 +386,7 @@ class SortedSetIteratorTest extends StandardTestCase
                     array('member:1st', 1.0), array('member:2nd', 2.0),
                ))));
 
-        $iterator = new SortedSetIterator($client, 'key:zset', 'member:*', 2);
+        $iterator = new SortedSetKey($client, 'key:zset', 'member:*', 2);
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -425,7 +425,7 @@ class SortedSetIteratorTest extends StandardTestCase
                     array('member:2nd', 2.0),
                 ))));
 
-        $iterator = new SortedSetIterator($client, 'key:zset', 'member:*', 1);
+        $iterator = new SortedSetKey($client, 'key:zset', 'member:*', 1);
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());
@@ -458,7 +458,7 @@ class SortedSetIteratorTest extends StandardTestCase
                     array('member:1st', 1.0), array('member:2nd', 2.0),
                ))));
 
-        $iterator = new SortedSetIterator($client, 'key:zset');
+        $iterator = new SortedSetKey($client, 'key:zset');
 
         $iterator->rewind();
         $this->assertTrue($iterator->valid());