Add support for zpopmax and zpopmin redis commands (server 5.0.0+)

This commit is contained in:
Vladimir Solomatin 2019-02-07 20:18:08 +03:00
parent ca9cde0487
commit ebf7bd2d82
No known key found for this signature in database
GPG Key ID: 4D661D719C32DD03
3 changed files with 11 additions and 1 deletions

View File

@ -139,6 +139,8 @@ Command Command::CmdPool[AvailableCommands] = {
{Zincrby, "zincrby", 4, 4, Write}, {Zincrby, "zincrby", 4, 4, Write},
{Zinterstore, "zinterstore", 4, MaxArgs, Write}, {Zinterstore, "zinterstore", 4, MaxArgs, Write},
{Zlexcount, "zlexcount", 4, 4, Read}, {Zlexcount, "zlexcount", 4, 4, Read},
{Zpopmax, "zpopmax", 2, 3, Write},
{Zpopmin, "zpopmin", 2, 3, Write},
{Zrange, "zrange", 4, 5, Read}, {Zrange, "zrange", 4, 5, Read},
{Zrangebylex, "zrangebylex", 4, 7, Read}, {Zrangebylex, "zrangebylex", 4, 7, Read},
{Zrangebyscore, "zrangebyscore", 4, 8, Read}, {Zrangebyscore, "zrangebyscore", 4, 8, Read},

View File

@ -156,6 +156,8 @@ public:
Zincrby, Zincrby,
Zinterstore, Zinterstore,
Zlexcount, Zlexcount,
Zpopmax,
Zpopmin,
Zrange, Zrange,
Zrangebylex, Zrangebylex,
Zrangebyscore, Zrangebyscore,

View File

@ -391,7 +391,7 @@ Cases = [
[('scard', '{k}2'), 3], [('scard', '{k}2'), 3],
]), ]),
('zset', [ ('zset', [
[('del', 'k', '{k}2', '{k}3', '{k}4'), ], [('del', 'k', '{k}2', '{k}3', '{k}4', '{k}5', '{k}6'), ],
[('zadd', 'k', 10, 'apple'), 1], [('zadd', 'k', 10, 'apple'), 1],
[('zcard', 'k'), 1], [('zcard', 'k'), 1],
[('zincrby', 'k', 2, 'apple'), '12'], [('zincrby', 'k', 2, 'apple'), '12'],
@ -438,6 +438,12 @@ Cases = [
[('zunionstore', '{k}3', 2, 'k', '{k}2'), 4], [('zunionstore', '{k}3', 2, 'k', '{k}2'), 4],
[('zunionstore', '{k}3', 2, 'k', '{k}2', 'AGGREGATE', 'MAX'), 4], [('zunionstore', '{k}3', 2, 'k', '{k}2', 'AGGREGATE', 'MAX'), 4],
[('zunionstore', '{k}3', 2, 'k', '{k}2', 'WEIGHTS', 0.5, 1.2, 'AGGREGATE', 'MAX'), 4], [('zunionstore', '{k}3', 2, 'k', '{k}2', 'WEIGHTS', 0.5, 1.2, 'AGGREGATE', 'MAX'), 4],
[('zadd', '{k}5', 0, 'apple', 9, 'banana', 1, 'pear', 3, 'orange', 4, 'cat'), 5],
[('zpopmax', '{k}5'), ['banana', '9']],
[('zpopmax', '{k}5', 3), ['cat', '4', 'orange', '3', 'pear', '1']],
[('zadd', '{k}6', 0, 'apple', 9, 'banana', 1, 'pear', 3, 'orange', 4, 'cat'), 5],
[('zpopmin', '{k}6'), ['apple', '0']],
[('zpopmin', '{k}6', 3), ['pear', '1', 'orange', '3', 'cat', '4']],
]), ]),
('hyperloglog', [ ('hyperloglog', [
[('del', 'k', '{k}2', '{k}3'), ], [('del', 'k', '{k}2', '{k}3'), ],