Redis Smove command
Redis Smove command specifies a member member set of elements from the source to the destination mobile collection.
SMOVE atomic operations.
If the source collection does not exist or does not contain the elements specified member, the SMOVE command does not do anything, just return 0. Otherwise, member element is removed from the source collection, and added to the destination set to go.
When the destination already contains a collection of member elements, SMOVE command simply the source collection member elements removed.
When the source or destination is not a collection type, an error is returned.
grammar
redis Smove basic command syntax is as follows:
redis 127.0.0.1:6379> SMOVE SOURCE DESTINATION MEMBER
Available versions
> = 1.0.0
return value
If the members of the element is removed successfully, returns 1. If the element is not a member of member of the collection source, destination and without any action on the implementation of the set, then 0 is returned.
Examples
redis 127.0.0.1:6379> SADD myset1 "hello" (integer) 1 redis 127.0.0.1:6379> SADD myset1 "world" (integer) 1 redis 127.0.0.1:6379> SADD myset1 "bar" (integer) 1 redis 127.0.0.1:6379> SADD myset2 "foo" (integer) 1 redis 127.0.0.1:6379> SMOVE myset1 myset2 "bar" (integer) 1 redis 127.0.0.1:6379> SMEMBERS myset1 1) "World" 2) "Hello" redis 127.0.0.1:6379> SMEMBERS myset2 1) "foo" 2) "bar"