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)命令

An Introduction to Genetic Algorithms

An Introduction to Genetic Algorithms

Melanie Mitchell / MIT Press / 1998-2-6 / USD 45.00

Genetic algorithms have been used in science and engineering as adaptive algorithms for solving practical problems and as computational models of natural evolutionary systems. This brief, accessible i......一起来看看 《An Introduction to Genetic Algorithms》 这本书的介绍吧!

HTML 压缩/解压工具

HTML 压缩/解压工具

在线压缩/解压 HTML 代码

在线进制转换器

在线进制转换器

各进制数互转换器

HEX CMYK 转换工具

HEX CMYK 转换工具

HEX CMYK 互转工具