mirror of
https://github.com/predis/predis.git
synced 2026-08-31 12:43:31 +00:00
Added vector sets commands to ClusterStrategy (#1710)
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
- Added support for `LMOVEM` and `BLMOVEM` commands
|
||||
- Added support for `FT.ALIASLIST` command
|
||||
- Added stream commands to ClusterStrategy
|
||||
- Added vector sets commands to ClusterStrategy
|
||||
|
||||
### Fixed
|
||||
- Fixed Sentinel does not wipe servers on exception caused (#1694)
|
||||
|
||||
@@ -201,6 +201,20 @@ abstract class ClusterStrategy implements StrategyInterface
|
||||
'XSETID' => $getKeyFromFirstArgument,
|
||||
'XTRIM' => $getKeyFromFirstArgument,
|
||||
|
||||
/* commands operating on vector sets */
|
||||
'VADD' => $getKeyFromFirstArgument,
|
||||
'VCARD' => $getKeyFromFirstArgument,
|
||||
'VDIM' => $getKeyFromFirstArgument,
|
||||
'VEMB' => $getKeyFromFirstArgument,
|
||||
'VGETATTR' => $getKeyFromFirstArgument,
|
||||
'VINFO' => $getKeyFromFirstArgument,
|
||||
'VLINKS' => $getKeyFromFirstArgument,
|
||||
'VRANDMEMBER' => $getKeyFromFirstArgument,
|
||||
'VRANGE' => $getKeyFromFirstArgument,
|
||||
'VREM' => $getKeyFromFirstArgument,
|
||||
'VSETATTR' => $getKeyFromFirstArgument,
|
||||
'VSIM' => $getKeyFromFirstArgument,
|
||||
|
||||
/* commands operating on time series */
|
||||
'TS.READ' => $getKeyFromFirstArgument,
|
||||
|
||||
|
||||
@@ -331,6 +331,25 @@ class PredisStrategyTest extends PredisTestCase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
public function testKeysForVectorSetCommands(): void
|
||||
{
|
||||
$strategy = $this->getClusterStrategy();
|
||||
$commands = $this->getCommandFactory();
|
||||
|
||||
$arguments = [
|
||||
'VADD' => ['key', [1.0, 2.0], 'element'],
|
||||
'VSIM' => ['key', [1.0, 2.0]],
|
||||
];
|
||||
|
||||
foreach ($this->getExpectedCommands('keys-vector') as $commandID) {
|
||||
$command = $commands->create($commandID, $arguments[$commandID]);
|
||||
$this->assertSame($strategy->getSlotByKey('key'), $strategy->getSlot($command), $commandID);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
@@ -667,6 +686,20 @@ class PredisStrategyTest extends PredisTestCase
|
||||
'XSETID' => 'keys-first',
|
||||
'XTRIM' => 'keys-first',
|
||||
|
||||
/* commands operating on vector sets */
|
||||
'VADD' => 'keys-vector',
|
||||
'VCARD' => 'keys-first',
|
||||
'VDIM' => 'keys-first',
|
||||
'VEMB' => 'keys-first',
|
||||
'VGETATTR' => 'keys-first',
|
||||
'VINFO' => 'keys-first',
|
||||
'VLINKS' => 'keys-first',
|
||||
'VRANDMEMBER' => 'keys-first',
|
||||
'VRANGE' => 'keys-first',
|
||||
'VREM' => 'keys-first',
|
||||
'VSETATTR' => 'keys-first',
|
||||
'VSIM' => 'keys-vector',
|
||||
|
||||
/* commands operating on time series */
|
||||
'TS.READ' => 'keys-first',
|
||||
|
||||
|
||||
@@ -341,6 +341,25 @@ class RedisStrategyTest extends PredisTestCase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
public function testKeysForVectorSetCommands(): void
|
||||
{
|
||||
$strategy = $this->getClusterStrategy();
|
||||
$commands = $this->getCommandFactory();
|
||||
|
||||
$arguments = [
|
||||
'VADD' => ['key', [1.0, 2.0], 'element'],
|
||||
'VSIM' => ['key', [1.0, 2.0]],
|
||||
];
|
||||
|
||||
foreach ($this->getExpectedCommands('keys-vector') as $commandID) {
|
||||
$command = $commands->create($commandID, $arguments[$commandID]);
|
||||
$this->assertSame($strategy->getSlotByKey('key'), $strategy->getSlot($command), $commandID);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
@@ -687,6 +706,20 @@ class RedisStrategyTest extends PredisTestCase
|
||||
'XSETID' => 'keys-first',
|
||||
'XTRIM' => 'keys-first',
|
||||
|
||||
/* commands operating on vector sets */
|
||||
'VADD' => 'keys-vector',
|
||||
'VCARD' => 'keys-first',
|
||||
'VDIM' => 'keys-first',
|
||||
'VEMB' => 'keys-first',
|
||||
'VGETATTR' => 'keys-first',
|
||||
'VINFO' => 'keys-first',
|
||||
'VLINKS' => 'keys-first',
|
||||
'VRANDMEMBER' => 'keys-first',
|
||||
'VRANGE' => 'keys-first',
|
||||
'VREM' => 'keys-first',
|
||||
'VSETATTR' => 'keys-first',
|
||||
'VSIM' => 'keys-vector',
|
||||
|
||||
/* commands operating on time series */
|
||||
'TS.READ' => 'keys-first',
|
||||
|
||||
|
||||
Reference in New Issue
Block a user