Monday, August 20, 2012

Redis sets multi operations

redis 127.0.0.1:6379> sadd a 1 2 3 5 6
(integer) 5
redis 127.0.0.1:6379> sadd b  3 5 6 7 8
(integer) 5
redis 127.0.0.1:6379> SINTER a b
1) "3"
2) "5"
3) "6"
redis 127.0.0.1:6379> sunion a b
1) "1"
2) "2"
3) "3"
4) "5"
5) "6"
6) "7"
7) "8"
redis 127.0.0.1:6379> sdiff a b
1) "1"
2) "2"
redis 127.0.0.1:6379> sdiff  b a
1) "7"
2) "8"
redis 127.0.0.1:6379>

Try Redis online @ http://www.redis4you.com/

No comments: