redis|redis-py zadd 和 zincrby的设计简直让我理解不能啊
伊谢尔伦
伊谢尔伦 2017-04-25 09:04:21
0
1
641

redis
zadd命令为 zadd 变量 val key
zincrby命令为 zincrby 变量 val key

hset的命令为 hset 变量 key val 像hash这种赋值为key val的赋值方式我是很理解的

z系列的东西是val key就算了,然而redis.py里面的设计为什么这么诡异

conn.zadd 变量 val key 跟 redis的zadd顺序一致
conn.zincrby 变量 key val跟 redis的zincrby顺序相反

理解不能啊,首先zadd里面当年为毛设计成val key而不是key val,其次写redis-py的作者是怎么想的,为毛zadd与zincrby一个跟默认命令顺序相同,一个跟默认命令相反?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(1)
淡淡烟草味

Because the names of these parameters are not what you wrote:

zadd命令为 zadd 变量 val key

but

zadd key score member

key是有序集合的key,你所谓的val是集合里面每个成员的分数,而最后是成员。这东西和普通的set key valueThey are completely two different things.

But whyscore member而不是member scoreI don’t know exactly. I’m just guessing that maybe the designer thinks this is similar to the ranking list. Ranking lists usually rank at the top and who is at the bottom

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template