zoukankan      html  css  js  c++  java
  • redis order set 结构

    order set 结构

    127.0.0.1:6379> zadd class 12 lily 13 lucy 18 lilei  8 poly
    (integer) 0
    127.0.0.1:6379> zadd class 12 lily 13 lucy 18 lilei 8 poly
    (integer) 0
    127.0.0.1:6379> keys *
    1) "class"
    127.0.0.1:6379> zrange class 8 18
    (empty list or set)
    127.0.0.1:6379> zrange class 0 -1
    1) "poly"
    2) "lily"
    3) "lucy"
    4) "lilei"
    127.0.0.1:6379> zrangebyscore class 13 18
    1) "lucy"
    2) "lilei"
    127.0.0.1:6379> zrangebyscore class 1 20 limit 1 2
    1) "lily"
    2) "lucy"
    127.0.0.1:6379> zrange class 0 -1 withscores
    1) "poly"
    2) "8"
    3) "lily"
    4) "12"
    5) "lucy"
    6) "13"
    7) "lilei"
    8) "18"
    127.0.0.1:6379> zrangebyscore class 13 18 withscores
    1) "lucy"
    2) "13"
    3) "lilei"
    4) "18"
    127.0.0.1:6379> zrank class lily
    (integer) 1
    127.0.0.1:6379> zrank class sili
    (nil)
    127.0.0.1:6379> zrevrank class lily
    (integer) 2
    127.0.0.1:6379> zremrangebyscore class 10 15
    (integer) 2
    127.0.0.1:6379> zrange class 0 -1 withscores
    1) "poly"
    2) "8"
    3) "lilei"
    4) "18"
    127.0.0.1:6379> zadd class 12 lily 13 lucy
    (integer) 2
    127.0.0.1:6379> zrange class 0 -1 withscores
    1) "poly"
    2) "8"
    3) "lily"
    4) "12"
    5) "lucy"
    6) "13"
    7) "lilei"
    8) "18"
    127.0.0.1:6379> zremrangebyrank class 0 1
    (integer) 2
    127.0.0.1:6379> zrange class 0 -1 withscores
    1) "lucy"
    2) "13"
    3) "lilei"
    4) "18"
    127.0.0.1:6379> zrem class lucy
    (integer) 1
    127.0.0.1:6379> zrem class lilei
    (integer) 1
    127.0.0.1:6379> zrange class 0 -1 withscores
    (empty list or set)
    127.0.0.1:6379> zadd taoyuan 25 zhangfei 27 guanyu 28 liubei
    (integer) 3
    127.0.0.1:6379> zcard taoyuan
    (integer) 3
    127.0.0.1:6379> zadd taoyuan 23 zhaoyun
    (integer) 1
    127.0.0.1:6379> zcount taoyuan 10 30
    (integer) 4
    127.0.0.1:6379> zadd lisi 2 cat 4 dog 6 horse
    (integer) 3
    127.0.0.1:6379> zadd wang 2 cat 5 dog 8 hourse 1 donkey
    (integer) 4
    127.0.0.1:6379> zinterstore res lisi wang aggregate
    (error) ERR value is not an integer or out of range
    127.0.0.1:6379> zinterstore res lisi wang sum
    (error) ERR value is not an integer or out of range
    127.0.0.1:6379> zinterstore res lisi wang
    (error) ERR value is not an integer or out of range
    127.0.0.1:6379> zadd lisi 2 donkey
    (integer) 1
    127.0.0.1:6379> zinterstore res lisi wang
    (error) ERR value is not an integer or out of range
    127.0.0.1:6379> keys *
    1) "lisi"
    2) "taoyuan"
    3) "wang"
    127.0.0.1:6379> del taoyuan
    (integer) 1
    127.0.0.1:6379> zinterstore res 2 lizi wang
    (integer) 0
    127.0.0.1:6379> zinterstore res 2 lisi wang
    (integer) 3
    127.0.0.1:6379> zrange res 0 -1 withscores
    1) "donkey"
    2) "3"
    3) "cat"
    4) "4"
    5) "dog"
    6) "9"
    127.0.0.1:6379> zinterstore res 2 lisi wang aggregate min
    (integer) 3
    127.0.0.1:6379> zrange res 0 -1 withscores
    1) "donkey"
    2) "1"
    3) "cat"
    4) "2"
    5) "dog"
    6) "4"
    127.0.0.1:6379> zinterstore res 2 lisi wang aggregate max
    (integer) 3
    127.0.0.1:6379> zrange res 0 -1 withscores
    1) "cat"
    2) "2"
    3) "donkey"
    4) "2"
    5) "dog"
    6) "5"
    127.0.0.1:6379> zinterstore res 2 lisi wang weight 2 1 aggregate max
    (error) ERR syntax error
    127.0.0.1:6379> zinterstore res 2 lisi wang weights 2 1 aggregate max
    (integer) 3
    127.0.0.1:6379> zrange res 0 -1 withscores
    1) "cat"
    2) "4"
    3) "donkey"
    4) "4"
    5) "dog"
    6) "8"
    
  • 相关阅读:
    CtsVerifier-Bluetooth-LE-SEcure-ClientServer-Test测试pass但是无法选择PassButton
    error: 'LOG_TAG' macro redefined
    AndroidBuildSystem资料
    [dumpsys input]dumpsys input没有KeyEvent-KeyCode-MotionEvent键值
    [GTS]GtsSecurityHostTestCases#testNoExemptionsForSocketsBetweenCoreAndVendorBan
    [Gts]Fail-GtsTvTestCases#testLauncherChange
    [Cts-Verifier]waiver-Camera-ITS-Test
    历史角度看Support Library 到 AndroidX
    基于大疆无人机SDK二次开发
    关于Support库28及以上版本无法查看源码问题
  • 原文地址:https://www.cnblogs.com/sha-ka/p/12779259.html
Copyright © 2011-2022 走看看