Redis Srem 命令

更新时间: 2019-07-07 15:54

Redis Srem 命令用于移除集合中的一个或多个成员元素,不存在的成员元素会被忽略。

当 key 不是集合类型,返回一个错误。

在 Redis 2.4 版本以前, SREM 只接受单个成员值。

语法

redis 127.0.0.1:6379> SREM KEY MEMBER1..MEMBERN

返回值

被成功移除的元素的数量,不包括被忽略的元素。

实例

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> SREM myset1 "hello"
(integer) 1
redis 127.0.0.1:6379> SREM myset1 "foo"
(integer) 0
redis 127.0.0.1:6379> SMEMBERS myset1
1) "bar"
2) "world"

查看更多 Redis 集合(Set)命令

Code Reading

Code Reading

Diomidis Spinellis / Addison-Wesley Professional / 2003-06-06 / USD 64.99

This book is a unique and essential reference that focuses upon the reading and comprehension of existing software code. While code reading is an important task faced by the vast majority of students,......一起来看看 《Code Reading》 这本书的介绍吧!

HTML 压缩/解压工具

HTML 压缩/解压工具

在线压缩/解压 HTML 代码

在线进制转换器

在线进制转换器

各进制数互转换器

SHA 加密

SHA 加密

SHA 加密工具