mirror of
https://github.com/predis/predis.git
synced 2026-08-30 12:15:03 +00:00
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:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user