Key(键) String(字符串) Hash(哈希表) List(列表) Set(集合) SortedSet(有序集合) HyperLogLog GEO(地理位置) Pub/Sub(发布/订阅) Transaction(事务) Script(脚本) Connection(连接) Server(服务器)

发布于 2015-09-04 08:51:25 | 272 次阅读 | 评论: 0 | 来源: 网络整理

SMOVE source destination member

member 元素从 source 集合移动到 destination 集合。

SMOVE 是原子性操作。

如果 source 集合不存在或不包含指定的 member 元素,则 SMOVE 命令不执行任何操作,仅返回 0 。否则, member 元素从 source 集合中被移除,并添加到 destination 集合中去。

destination 集合已经包含 member 元素时, SMOVE 命令只是简单地将 source 集合中的 member 元素删除。

sourcedestination 不是集合类型时,返回一个错误。

可用版本:
>= 1.0.0
时间复杂度:
O(1)
返回值:
如果 member 元素被成功移除,返回 1
如果 member 元素不是 source 集合的成员,并且没有任何操作对 destination 集合执行,那么返回 0
redis> SMEMBERS songs
1) "Billie Jean"
2) "Believe Me"

redis> SMEMBERS my_songs
(empty list or set)

redis> SMOVE songs my_songs "Believe Me"
(integer) 1

redis> SMEMBERS songs
1) "Billie Jean"

redis> SMEMBERS my_songs
1) "Believe Me"
最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务