redis 篇 - set

set

  • 无序集合

  • sadd key value

    127.0.0.1:6379[7]> sadd s 3
    (integer) 1
    127.0.0.1:6379[7]> smembers s
    1) "1"
    2) "2"
    3) "3"
    127.0.0.1:6379[7]>
    
  • scard

  • sdiff

    127.0.0.1:6379[7]> scard s
    (integer) 3
    127.0.0.1:6379[7]> sadd s1 1
    (integer) 1
    127.0.0.1:6379[7]> sdiff s1 s
    (empty list or set)
    127.0.0.1:6379[7]> sdiff s s1
    1) "2"
    2) "3"
    127.0.0.1:6379[7]>
    
posted @ 2018-10-30 17:16  两只老虎111  阅读(132)  评论(0编辑  收藏  举报