redis基本类型 set类型

本文详细介绍了Redis中的集合操作,包括SADD、SCARD、SDIFF、SDIFFSTORE、SINTER、SINTERSTORE、SISMEMBER、SMEMBERS、SMOVE、SPOP、SRANDMEMBER、SREM、SSCAN、SUNION和SUNIONSTORE等,这些操作用于管理无序且唯一成员的集合,涵盖了集合的添加、删除、交集、并集、差集等常见操作,适用于数据存储和处理场景。
摘要由CSDN通过智能技术生成

一、特点

        存的值唯一,不可重复,无序

二、操作

1)SADD key member [member ...]        向集合中添加一个或多个成员

summary: Add one or more members to a set
since: 1.0.0

2)SCARD key        获取集合中成员数量

summary: Get the number of members in a set
since: 1.0.0

3)SDIFF key [key ...]        set01-set02的差集

summary: Subtract multiple sets
since: 1.0.0

4)SDIFFSTORE destination key [key ...]        key1- key2 的差集 并返回到一个key中

summary: Subtract multiple sets and store the resulting set in a key
since: 1.0.0

5)SINTER key [key ...]  key1和key2的交集

summary: Intersect multiple sets
since: 1.0.0

6)SINTERSTORE destination key [key ...] key1和key2的交集 并返回到一个key中

summary: Intersect multiple sets and store the resulting set in a key
since: 1.0.0

7)SISMEMBER key member 给定一个值是否为集合中的成员(是返回 1,否返回 0)

summary: Determine if a given value is a member of a set
since: 1.0.0

8)SMEMBERS key 获取集合中所有成员

summary: Get all the members in a set
since: 1.0.0

 9)SMISMEMBER key member [member ...]        返回集合中与给定元素关联的成员关系

summary: Returns the membership associated with the given elements for a set
since: 6.2.0

10)SMOVE source destination member        将一个成员从一个集合移动到另一个集合

summary: Move a member from one set to another
since: 1.0.0

11)SPOP key [count]        删除集合中一个或多个并返回随机多个成员

summary: Remove and return one or multiple random members from a set
since: 1.0.0

12)SRANDMEMBER key [count]        从集合中获取一个或多个成员

summary: Get one or multiple random members from a set
since: 1.0.0

13)SREM key member [member ...]        从集合中删除一个或多个成员

summary: Remove one or more members from a set
since: 1.0.0

14)SSCAN key cursor [MATCH pattern] [COUNT count]        递增迭代Set元素

summary: Incrementally iterate Set elements
since: 2.8.0

15)SUNION key [key ...]     添加多个集   

summary: Add multiple sets
since: 1.0.0

16)SUNIONSTORE destination key [key ...]        添加多个集并将结果集存储在一个键中

summary: Add multiple sets and store the resulting set in a key
since: 1.0.0

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值