gpt4 book ai didi

perl - perl 中的 zrangebyscore redis

转载 作者:可可西里 更新时间:2023-11-01 11:01:41 26 4
gpt4 key购买 nike

我在 perl 脚本中使用 Redis.pm 并尝试执行下一个命令:

zrevrangebyscore <key> <highscore> 0 WITHSCORES LIMIT 0 1

在我接下来编写的带有 redis 文档的设备中,它工作正常

my $data = { $redis->zrevrangebyscore($rkey, $ipl, 0, 'WITHSCORES') };

但是当我尝试在 perl 命令中替换 'limit...' 时:

my $data = { $redis->zrevrangebyscore($rkey, $ipl, 0, 'WITHSCORES','LIMIT 0 1') };

我有错误

[zrevrangebyscore] ERR syntax error,  at /usr/local/lib/perl5/site_perl/5.14/Redis.pm line 163
Redis::__ANON__(undef, 'ERR syntax error') called at /usr/local/lib/perl5/site_perl/5.14/Redis.pm line 195
Redis::wait_one_response('Redis=HASH(0x801075300)') called at /usr/local/lib/perl5/site_perl/5.14/Redis.pm line 183
Redis::wait_all_responses('Redis=HASH(0x801075300)') called at /usr/local/lib/perl5/site_perl/5.14/Redis.pm line 172

我如何在 Redis.pm 中传递参数 'LIMIT 0 1'?

最佳答案

答案是:

my $data = { $redis->zrevrangebyscore($rkey, $ipl, 0, 'WITHSCORES', qw{LIMIT 0 1})};

可能对某些人有用。谢谢!

关于perl - perl 中的 zrangebyscore redis,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18439205/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com