mirror of
https://github.com/predis/predis.git
synced 2026-09-14 04:17:14 +00:00
Fix eval_ro cluster support (#1449)
This commit is contained in:
@@ -163,6 +163,8 @@ abstract class ClusterStrategy implements StrategyInterface
|
||||
/* scripting */
|
||||
'EVAL' => [$this, 'getKeyFromScriptingCommands'],
|
||||
'EVALSHA' => [$this, 'getKeyFromScriptingCommands'],
|
||||
'EVAL_RO' => [$this, 'getKeyFromScriptingCommands'],
|
||||
'EVALSHA_RO' => [$this, 'getKeyFromScriptingCommands'],
|
||||
|
||||
/* server */
|
||||
'INFO' => [$this, 'getFakeKey'],
|
||||
|
||||
@@ -231,6 +231,21 @@ class PredisStrategyTest extends PredisTestCase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
public function testKeysForEvalReadOnlyCommand(): void
|
||||
{
|
||||
$strategy = $this->getClusterStrategy();
|
||||
$commands = $this->getCommandFactory();
|
||||
$arguments = ['%SCRIPT%', ['{key}:1', '{key}:2'], 'value1', 'value2'];
|
||||
|
||||
foreach ($this->getExpectedCommands('keys-script-ro') as $commandID) {
|
||||
$command = $commands->create($commandID, $arguments);
|
||||
$this->assertNotNull($strategy->getSlot($command), $commandID);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
@@ -452,6 +467,8 @@ class PredisStrategyTest extends PredisTestCase
|
||||
/* scripting */
|
||||
'EVAL' => 'keys-script',
|
||||
'EVALSHA' => 'keys-script',
|
||||
'EVAL_RO' => 'keys-script-ro',
|
||||
'EVALSHA_RO' => 'keys-script-ro',
|
||||
|
||||
/* server */
|
||||
'INFO' => 'keys-fake',
|
||||
|
||||
@@ -246,6 +246,21 @@ class RedisStrategyTest extends PredisTestCase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
public function testKeysForEvalReadOnlyCommand(): void
|
||||
{
|
||||
$strategy = $this->getClusterStrategy();
|
||||
$commands = $this->getCommandFactory();
|
||||
$arguments = ['%SCRIPT%', ['key:1'], 'value1'];
|
||||
|
||||
foreach ($this->getExpectedCommands('keys-script-ro') as $commandID) {
|
||||
$command = $commands->create($commandID, $arguments);
|
||||
$this->assertNotNull($strategy->getSlot($command), $commandID);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
@@ -475,6 +490,8 @@ class RedisStrategyTest extends PredisTestCase
|
||||
/* scripting */
|
||||
'EVAL' => 'keys-script',
|
||||
'EVALSHA' => 'keys-script',
|
||||
'EVAL_RO' => 'keys-script-ro',
|
||||
'EVALSHA_RO' => 'keys-script-ro',
|
||||
|
||||
/* server */
|
||||
'INFO' => 'keys-fake',
|
||||
|
||||
Reference in New Issue
Block a user