Redis 集合(Set)命令

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

Redis 的 Set 是 String 类型的无序集合。集合成员是唯一的,这就意味着集合中不能出现重复的数据。

Redis 中集合是通过哈希表实现的,所以添加,删除,查找的复杂度都是 O(1)。

下表列出了 Redis 集合基本命令:

序号 命令 描述
1 Redis Sadd 命令 向集合添加一个或多个成员
2 Redis Scard 命令 获取集合的成员数
3 Redis Sdiff 命令 返回给定所有集合的差集
4 Redis Sdiffstore 命令 返回给定所有集合的差集并存储在 destination 中
5 Redis Sinter 命令 返回给定所有集合的交集
6 Redis Sinterstore 命令 返回给定所有集合的交集并存储在 destination 中
7 Redis Sismember 命令 判断 member 元素是否是集合 key 的成员
8 Redis Smembers 命令 返回集合中的所有成员
9 Redis Smove 命令 将 member 元素从 source 集合移动到 destination 集合
10 Redis Spop 命令 移除并返回集合中的一个随机元素
11 Redis Srandmember 命令 返回集合中一个或多个随机数
12 Redis Srem 命令 移除集合中一个或多个成员
13 Redis Sunion 命令 返回所有给定集合的并集
14 Redis Sunionstore 命令 所有给定集合的并集存储在 destination 集合中
15 Redis Sscan 命令 迭代集合中的元素

更多命令请参考:Redis 命令

Natural Language Processing with Python

Natural Language Processing with Python

Steven Bird、Ewan Klein、Edward Loper / O'Reilly Media / 2009-7-10 / USD 44.99

This book offers a highly accessible introduction to Natural Language Processing, the field that underpins a variety of language technologies, ranging from predictive text and email filtering to autom......一起来看看 《Natural Language Processing with Python》 这本书的介绍吧!

随机密码生成器

随机密码生成器

多种字符组合密码

HTML 编码/解码

HTML 编码/解码

HTML 编码/解码

UNIX 时间戳转换

UNIX 时间戳转换

UNIX 时间戳转换