Key(键) String(字符串) Hash(哈希表) List(列表) Set(集合) SortedSet(有序集合) HyperLogLog GEO(地理位置) Pub/Sub(发布/订阅) Transaction(事务) Script(脚本) Connection(连接) Server(服务器)

发布于 2015-09-04 08:57:08 | 271 次阅读 | 评论: 0 | 来源: 网络整理

ZINCRBY key increment member

为有序集 key 的成员 memberscore 值加上增量 increment

可以通过传递一个负数值 increment ,让 score 减去相应的值,比如 ZINCRBY key -5 member ,就是让 memberscore 值减去 5

key 不存在,或 member 不是 key 的成员时, ZINCRBY key increment member 等同于 ZADD key increment member

key 不是有序集类型时,返回一个错误。

score 值可以是整数值或双精度浮点数。

可用版本:
>= 1.2.0
时间复杂度:
O(log(N))
返回值:
member 成员的新 score 值,以字符串形式表示。
redis> ZSCORE salary tom
"2000"

redis> ZINCRBY salary 2000 tom   # tom 加薪啦!
"4000"
最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务