Sunday, 12 April 2015

SMOVE source destination member

Syntax
SMOVE source destination member
    Remove the member from source, and add the member to the destination.

Returns
    1 if the element is moved.
    0 if the element is not a member of source and no operation was performed.

127.0.0.1:6379> sadd set1 2 4 6 8 
(integer) 4 
127.0.0.1:6379> sadd set2 1 3 5 7 4 6 
(integer) 6 
127.0.0.1:6379> smove set1 set2 2 
(integer) 1 
127.0.0.1:6379> smove set1 set2 4 
(integer) 1 
127.0.0.1:6379> smove set1 set2 9 
(integer) 0 
127.0.0.1:6379> smembers set1 
1) "6" 
2) "8" 
127.0.0.1:6379> smembers set2 
1) "1" 
2) "2" 
3) "3" 
4) "4" 
5) "5" 
6) "6" 
7) "7" 


Prevoius                                                 Next                                                 Home

No comments:

Post a Comment