分类: 系统运维
2012-11-27 10:53:34
redis 127.0.0.1:6379> sadd myset "hello" (integer) 1 redis 127.0.0.1:6379> sadd myset "world" (integer) 1 redis 127.0.0.1:6379> sadd myset "world" (integer) 0 redis 127.0.0.1:6379> smembers myset 1) "world" 2) "hello" redis 127.0.0.1:6379> |
redis 127.0.0.1:6379> sadd myset2 "one" (integer) 1 redis 127.0.0.1:6379> sadd myset2 "two" (integer) 1 redis 127.0.0.1:6379> sadd myset2 "three" (integer) 1 redis 127.0.0.1:6379> srem myset2 "one" (integer) 1 redis 127.0.0.1:6379> srem myset2 "four" (integer) 0 redis 127.0.0.1:6379> smembers myset2 1) "three" 2) "two" redis 127.0.0.1:6379> |
redis 127.0.0.1:6379> sadd myset3 "one"
(integer) 1 redis 127.0.0.1:6379> sadd myset3 "two" (integer) 1 redis 127.0.0.1:6379> sadd myset3 "three" (integer) 1 redis 127.0.0.1:6379> spop myset3 "three" redis 127.0.0.1:6379> smembers myset3 1) "two" 2) "one" redis 127.0.0.1:6379> |
redis 127.0.0.1:6379> smembers myset2 1) "three" 2) "two" redis 127.0.0.1:6379> smembers myset3 1) "two" 2) "one" redis 127.0.0.1:6379> sdiff myset2 myset3 1) "three" redis 127.0.0.1:6379> |
redis 127.0.0.1:6379> sdiff myset3 myset2
1) "one" redis 127.0.0.1:6379> |
redis 127.0.0.1:6379> smembers
myset2 1) "three" 2) "two" redis 127.0.0.1:6379> smembers myset3 1) "two" 2) "one" redis 127.0.0.1:6379> sdiffstore myset4 myset2 myset3 (integer) 1 redis 127.0.0.1:6379> smembers myset4 1) "three" redis 127.0.0.1:6379> |
redis 127.0.0.1:6379> smembers
myset2 1) "three" 2) "two" redis 127.0.0.1:6379> smembers myset3 1) "two" 2) "one" redis 127.0.0.1:6379> sinter myset2 myset3 1) "two" redis 127.0.0.1:6379> |
redis 127.0.0.1:6379> smembers
myset2 1) "three" 2) "two" redis 127.0.0.1:6379> smembers myset3 1) "two" 2) "one" redis 127.0.0.1:6379> sinterstore myset5 myset2 myset3 (integer) 1 redis 127.0.0.1:6379>smembers myset5 1) "two" redis 127.0.0.1:6379> |
redis 127.0.0.1:6379> smembers myset2
1) "three" 2) "two" redis 127.0.0.1:6379> smembers myset3 1) "two" 2) "one" redis 127.0.0.1:6379> sunion myset2 myset3 1) "three" 2) "one" 3) "two" redis 127.0.0.1:6379> |
redis 127.0.0.1:6379> smembers myset2
1) "three" 2) "two" redis 127.0.0.1:6379> smembers myset3 1) "two" 2) "one" redis 127.0.0.1:6379> sunionstore myset6 myset2 myset3 (integer) 3 redis 127.0.0.1:6379>smembers myset6 1) "three" 2) "one" 3) "two" redis 127.0.0.1:6379> |
redis 127.0.0.1:6379> smembers myset2
1) "three" 2) "two" redis 127.0.0.1:6379> smembers myset3 1) "two" 2) "one" redis 127.0.0.1:6379> smove myset2 myset7 three (integer) 1 redis 127.0.0.1:6379>smembers myset7 1) "three" redis 127.0.0.1:6379> |
redis 127.0.0.1:6379> scard myset2
(integer) 1 redis 127.0.0.1:6379> |
redis 127.0.0.1:6379> smembers myset2
1) "two" redis 127.0.0.1:6379> sismembers myset2 two (integer) 1 redis 127.0.0.1:6379>sismember myset2 one (integer) 0 redis 127.0.0.1:6379> |
redis 127.0.0.1:6379> smembers myset3 1) "two" 2) "one" redis 127.0.0.1:6379> srandmember myset3 "two" redis 127.0.0.1:6379>srandmember myset3 "one" redis 127.0.0.1:6379> |