Redis Perl Library: how to use sorted sets?
문제
I have a data structure in redis
that uses sorted sets for a "top items" system that I plan to use on my webpage. I am basically using the redis-cli
commands like ZRANGE
to get my top items out of redis.
Now I want to access this data programmatically in Perl. I have seen the Redis.pm library, but I could not find any signs of these Z*
methods there.
Can I use the Redis.pm library to work with sorted sets in redis or do I have to use another library?
해결책
Yes, you can use the Z* commands with Redis.pm
Actually, all the Redis commands are mapped in the Perl API, even if some of them are not documented. This is done through the AUTOLOAD feature of Perl.
The definition of the parameters of the commands follows the Redis documentation, except if the Redis.pm documentation states otherwise.
See this example in the non-regression testing scripts:
https://github.com/melo/perl-redis/blob/master/t/01-basic.t#L195