标签:pre set apple mem line redis mic 127.0.0.1 zset
ZSET 特点:
类似set集合,有序,元素为字符串,每个元素都关联着一个浮点分数值,并按照分值由小到大的顺序排列
ZADD: 增加一个或者多个元素
ZADD key [NX|XX] [CH] [INCR] score member [score member ...]
127.0.0.1:6379> ZADD bus 200000.0 大众迈腾 (integer) 1 127.0.0.1:6379> ZADD bus 300000.5 沃尔沃 (integer) 1 127.0.0.1:6379> ZADD bus 400000.8 雷克萨斯 (integer) 1 127.0.0.1:6379> ZADD bus 650000.0 牧马人 (integer) 1 127.0.0.1:6379> ZADD bus 800000.5 路虎 (integer) 1
ZREM:移除一个或多个元素
ZREM key member [member ...]
127.0.0.1:6379> ZREM bus 大众迈腾 (integer) 1 127.0.0.1:6379> ZREM bus 沃尔沃 (integer) 1 127.0.0.1:6379> ZREM bus 雷克萨斯 (integer) 1 127.0.0.1:6379> ZREM bus 牧马人 (integer) 1 127.0.0.1:6379> ZREM bus 路虎 (integer) 1
ZSCORE:显示分值
127.0.0.1:6379> ZSCORE bus 路虎 "850000.90000000002"
ZINCRBY:
ZINCRBY key increment member
127.0.0.1:6379> ZSCORE bus 路虎 "850000.90000000002" 127.0.0.1:6379> ZINCRBY bus 100000.9 路虎 "950001.80000000005" 127.0.0.1:6379> ZINCRBY bus -100000.9 路虎 "850000.90000000002"
标签:pre set apple mem line redis mic 127.0.0.1 zset
原文地址:https://www.cnblogs.com/songxiaohua/p/9729042.html