redis對象存儲(適用於訂單系統自動更新)

啓動:redis-server.exe redis.windows.conf
鏈接:redis-cli.exe -h 127.0.0.1 -p 6379redis

#插入取消的訂單列表與時間:
redis 127.0.0.1:6379> ZADD order:cancel 1529993230 8062614094334846949
redis 127.0.0.1:6379> ZADD order:cancel 1529994630 8062614094334842900
redis 127.0.0.1:6379> ZADD order:cancel 1529995652 8062614094334874222
redis 127.0.0.1:6379> ZADD order:cancel 1529985652 8062614094334891120

# 獲取所有的
ZRANGEBYSCORE order:cancel -inf +inf [WITHSCORES]
# 獲取時間小於1529995652
ZRANGEBYSCORE order:cancel -inf  1529994630
# 獲取單個指定訂單號的操做時間
ZSCORE  order:cancel 8062614094334891120
#返回訂單號數組下標記 按時間戳排序過了 經過 ZRANGE order:cancel 0 -1 [WITHSCORES] 查看所有
ZRANK  order:cancel  8062614094334874222
#移除指定訂單號 
ZREM order:cancel 8062614094334846949
相關文章
相關標籤/搜索