码迷,mamicode.com
首页 > 其他好文 > 详细

redis 集合

时间:2019-01-03 22:37:56      阅读:239      评论:0      收藏:0      [点我收藏+]

标签:rem   org   分享   java   members   srand   img   com   web3   

技术分享图片

 

技术分享图片
127.0.0.1:6379> SADD myset1 a b c
(integer) 3
127.0.0.1:6379> SADD web maiziedu.com
(integer) 1
127.0.0.1:6379> SADD web maiziedu.com
(integer) 0
127.0.0.1:6379> SADD web phpfamily.org jd.com
(integer) 2
127.0.0.1:6379> SADD web phpfamily.org jd.com
(integer) 0
127.0.0.1:6379> SADD web phpfamily.org jd.com taobao.com
(integer) 1
127.0.0.1:6379> SMEMBERS web
1) "jd.com"
2) "phpfamily.org"
3) "taobao.com"
4) "maiziedu.com"
127.0.0.1:6379> 
View Code

 

技术分享图片

 

 

127.0.0.1:6379> SADD web maiziedu.com
(integer) 1
127.0.0.1:6379> SADD web maiziedu.com
(integer) 0
127.0.0.1:6379> SADD web phpfamily.org jd.com
(integer) 2
127.0.0.1:6379> SADD web phpfamily.org jd.com
(integer) 0
127.0.0.1:6379> SADD web phpfamily.org jd.com taobao.com
(integer) 1
127.0.0.1:6379> SMEMBERS web
1) "jd.com"
2) "phpfamily.org"
3) "taobao.com"
4) "maiziedu.com"
127.0.0.1:6379> SISMEMBER web j
(integer) 0
127.0.0.1:6379> SISMEMBER web jd.com
(integer) 1
127.0.0.1:6379> SISMEMBER web taobao
(integer) 0
127.0.0.1:6379> SISMEMBER web taobao.com
(integer) 1
127.0.0.1:6379> SISMEMBER web3 taobao.com
(integer) 0
127.0.0.1:6379> SMEMBERS web
1) "jd.com"
2) "phpfamily.org"
3) "taobao.com"
4) "maiziedu.com"
127.0.0.1:6379> SREM web jd.com
(integer) 1
127.0.0.1:6379> SMEMBERS web
1) "phpfamily.org"
2) "taobao.com"
3) "maiziedu.com"
127.0.0.1:6379> SREM web taobao.com maiziedu.com
(integer) 2
127.0.0.1:6379> SMEMBERS web
1) "phpfamily.org"
127.0.0.1:6379> 

 技术分享图片

技术分享图片
127.0.0.1:6379> SADD mycourse php java c python android
(integer) 5
127.0.0.1:6379> SMEMBERS mycourse
1) "python"
2) "java"
3) "c"
4) "php"
5) "android"
127.0.0.1:6379> SPOP mycourse
"android"
127.0.0.1:6379> SPOP mycourse
"c"
127.0.0.1:6379> SMEMBERS mycourse
1) "java"
2) "php"
3) "python"
127.0.0.1:6379> 
View Code

 

技术分享图片

技术分享图片
127.0.0.1:6379> SMEMBERS mycourse
1) "java"
2) "php"
3) "python"
127.0.0.1:6379> clear
127.0.0.1:6379> SRANDMEMBER mycourse
"python"
127.0.0.1:6379> SRANDMEMBER mycourse
"java"
127.0.0.1:6379> SRANDMEMBER mycourse
"python"
127.0.0.1:6379> SRANDMEMBER mycourse
"php"
127.0.0.1:6379> SRANDMEMBER mycourse
"python"
127.0.0.1:6379> SRANDMEMBER mycourse
"php"
127.0.0.1:6379> SRANDMEMBER mycourse 2
1) "python"
2) "php"
127.0.0.1:6379> SRANDMEMBER mycourse 2
1) "python"
2) "java"
127.0.0.1:6379> SRANDMEMBER mycourse 2
1) "java"
2) "php"
127.0.0.1:6379> SRANDMEMBER mycourse 3
1) "python"
2) "java"
3) "php"
127.0.0.1:6379> SRANDMEMBER mycourse 3
1) "python"
2) "java"
3) "php"
127.0.0.1:6379> SRANDMEMBER mycourse -2
1) "php"
2) "php"
127.0.0.1:6379> SRANDMEMBER mycourse -2
1) "java"
2) "java"
127.0.0.1:6379> SRANDMEMBER mycourse -2
1) "java"
2) "php"
127.0.0.1:6379> 
View Code

 

redis 集合

标签:rem   org   分享   java   members   srand   img   com   web3   

原文地址:https://www.cnblogs.com/my-blogs-for-everone/p/10217185.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!