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"
    
  • 相关阅读:
    Exception 04 : java.lang.ClassNotFoundException: Could not load requested class : org.hsqldb.jdbcDriver
    Exception 03 : org.hibernate.MappingException: Unknown entity: org.hibernate.cfg.Configuration
    Exception 02 : java.lang.ClassNotFoundException: Could not load requested class : com.mysql.jdbc.Driver
    Exception 01 : org.hibernate.engine.jndi.JndiException: Error parsing JNDI name [foo]
    Hibernate的配置文件,hibernate.cfg.xml
    Struts2 框架使用 核心以及其他详细配置
    Eclipse项目小红叉
    关于使用 Spring 发送简单邮件
    SSH 结构中 不同角色登录,显示不同的菜单
    log4j.properties 日志文件的详细配置说明
  • 原文地址:https://www.cnblogs.com/sha-ka/p/12779259.html
Copyright © 2011-2022 走看看