Move key prefixing logic from command classes to prefix processor.

While command classes define how the client should filter arguments or
parse responses, key prefixing depends on the actual command signature
as defined by Redis so it really is something that should be handled
separately as the norm.

Developers can define new handlers or override existing ones, but they
can still define the key prefixing logic inside their command classes
by implementing Predis\Command\PrefixableCommandInterface: the key
prefix processor will just use that by overriding any defined handler.
This commit is contained in:
Daniele Alessandri
2013-11-29 15:32:21 +01:00
parent 5856bde198
commit d0b431016d
212 changed files with 1149 additions and 3434 deletions
-25
View File
@@ -57,31 +57,6 @@ class ZSetRemoveTest extends CommandTestCase
$this->assertSame(1, $this->getCommand()->parseResponse(1));
}
/**
* @group disconnected
*/
public function testPrefixKeys()
{
$arguments = array('zset', 'member1', 'member2', 'member3');
$expected = array('prefix:zset', 'member1', 'member2', 'member3');
$command = $this->getCommandWithArgumentsArray($arguments);
$command->prefixKeys('prefix:');
$this->assertSame($expected, $command->getArguments());
}
/**
* @group disconnected
*/
public function testPrefixKeysIgnoredOnEmptyArguments()
{
$command = $this->getCommand();
$command->prefixKeys('prefix:');
$this->assertSame(array(), $command->getArguments());
}
/**
* @group connected
*/