SMOVE
Syntax
SMOVE source destination member
- Available since:
- 1.0.0
- Time complexity:
- O(1)
- ACL categories:
-
@write
,@set
,@fast
,
将member
从source
集合移动到destination
集合。
此操作是原子性的。
在任何给定时刻,元素将显示为source
或
destination
集合的成员,对于其他客户端而言。
如果源集合不存在或不包含指定的元素,则不执行任何操作并返回0
。
否则,元素将从源集合中移除并添加到目标集合中。
当指定元素已经存在于目标集合中时,它只会从源集合中移除。
如果source
或destination
没有设置值,则返回错误。
示例
RESP2/RESP3 回复
以下之一:
- Integer reply: 如果元素被移动,则返回
1
。 - Integer reply:
0
如果元素不是source的成员且未执行任何操作。