mirror of
https://github.com/predis/predis.git
synced 2026-08-17 16:53:41 +00:00
Make ZRANDMEMBER prefixable (#1621)
* Make ZRANDMEMBER prefixable * Update CHANGELOG.md --------- Co-authored-by: Vladyslav Vildanov <117659936+vladvildanov@users.noreply.github.com>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
### Fixed
|
||||
- Fixed wrong `@param` annotation in `Parameters` (#1614)
|
||||
- Make `ZRANDMEMBER` prefixable (#1621)
|
||||
|
||||
### Added
|
||||
- Added retry support (#1616)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace Predis\Command\Redis;
|
||||
|
||||
use Predis\Command\Command as RedisCommand;
|
||||
use Predis\Command\PrefixableCommand as RedisCommand;
|
||||
use Predis\Command\Traits\With\WithScores;
|
||||
|
||||
/**
|
||||
@@ -33,4 +33,9 @@ class ZRANDMEMBER extends RedisCommand
|
||||
{
|
||||
return 'ZRANDMEMBER';
|
||||
}
|
||||
|
||||
public function prefixKeys($prefix)
|
||||
{
|
||||
$this->applyPrefixForFirstArgument($prefix);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,6 +457,10 @@ class KeyPrefixProcessorTest extends PredisTestCase
|
||||
['key', 1.0, 'member'],
|
||||
['prefix:key', 1.0, 'member'],
|
||||
],
|
||||
['ZRANDMEMBER',
|
||||
['key', 10],
|
||||
['prefix:key', 10],
|
||||
],
|
||||
['ZREM',
|
||||
['key', 'member1', 'member2', 'member3'],
|
||||
['prefix:key', 'member1', 'member2', 'member3'],
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
namespace Predis\Command\Redis;
|
||||
|
||||
use Predis\Command\PrefixableCommand;
|
||||
use Predis\Response\ServerException;
|
||||
|
||||
class ZRANDMEMBER_test extends PredisCommandTestCase
|
||||
@@ -93,6 +94,23 @@ class ZRANDMEMBER_test extends PredisCommandTestCase
|
||||
$this->assertNull($redis->zrandmember($notExpectedKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
public function testPrefixKeys(): void
|
||||
{
|
||||
/** @var PrefixableCommand $command */
|
||||
$command = $this->getCommand();
|
||||
$actualArguments = ['key', 10];
|
||||
$prefix = 'prefix:';
|
||||
$expectedArguments = ['prefix:key', 10];
|
||||
|
||||
$command->setArguments($actualArguments);
|
||||
$command->prefixKeys($prefix);
|
||||
|
||||
$this->assertSame($expectedArguments, $command->getArguments());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group connected
|
||||
* @requiresRedisVersion >= 6.2.0
|
||||
|
||||
Reference in New Issue
Block a user