当前位置:网站首页>Redis set 结构命令
Redis set 结构命令
2022-07-25 09:20:00 【yu-yuan】
集合特点:
1 . 无序性 2 . 唯一性 3 . 确定性
| 添加到集合中(已经存在的值不会进入集合) | sadd key value ..... |
| 查看集合中的所有元素 | smembers k vey |
| 删除集合中的元素 | srem key value |
| 随机抽取集合中的一个元素返回后删除 | spop key |
| 随机抽取一个元素但不删除 | srandmember key |
| 查看集合中是否有这个元素 | sismember key value |
| 查看这个集合中有几个元素 | scard |
| 从set1移动value到set2 | smore set1 set2 value |
| 多个集合中的value的交集 | sinter set1 set2 ...... |
| 多个集合中的value的并集 | sunion set1 set2 set3 |
| 多个集合中的value的差集 | sdiff set1 set2 set3 |
| 多个集合中的交集存入另一个集合 | sinterstore key set1 set2 set3 |
有序集合(order set)
| 添加到有序集合 | zadd key score1 value1 score2 value2 |
查看有序集合中的元素(排序查询) withscores(同时查询出store) | zrange key start shop withscores(可不写) |
| 靠标识取值(score)查询 (num)表示取几个 | zrangebyscore key min max 后加 limit offset num |
| 查询出value在集合中的score 是第几名 | zrank key value (升序) zrevrange key value (降序) |
删除集合中的那个元素 条件term1~term2 之间 元素 删除 | zrem key value1 value2..... zremrangebyscore key term1 term2 |
| 统计set中的元素个数 | zcard key |
| 统计set中term1~term2之间的元素 | zcount key term1 term2 |
| 多个集合之间做运算 | zinterstore set3 num(标识) set1 set2 aggregate sum/min/max |
| 合并两个集合 并求得交集 | zinterstore set3 num(标识) set1 set2 withscores |
边栏推荐
- Excl batch import data, background public parsing method
- 『每日一问』LockSupport怎么实现线程等待、唤醒
- DVWA练习一 暴力破解
- [GKCTF 2021]easynode
- matplotlib数据可视化三分钟入门,半小时入魔?
- 多态和接口
- [selected] from simple to deep, you will understand MQ principles and application scenarios
- MySQL takes the query result as the data updated by update, and concatenates it after the original field data (Lej)
- MySQL appends a string to the string of a field in the table [easy to understand]
- The interviewer asked: how to prevent oversold? There are several ways to achieve it
猜你喜欢
随机推荐
Deep understanding of static keyword
registration status: 204
Week summary
@2-1 CCF 2020-12-01 期末预测之安全指数
【代码源】每日一题 - 排队
『每日一问』怎么实现一个正确的双重检查锁定
那天帮妹纸装了个数据库。。。就又帮她整理了篇快捷键
[GPLT] 2022 大众情人(floyd)
Interviewer: tell me the difference between redis and mongodb? [easy to understand]
@3-1 CCF 2020-09-1 称检测点查询
ActiveMQ -- JDBC with persistent mechanism
C#语言和SQL Server数据库技术
How can technologists start their personal brand? Exclusive teaching of top five KOLs
Click to hide the column in wechat applet, and then click to show it
Redis的十大常见应用场景
卷积神经网络的兴趣简单介绍
『每日一问』volatile干嘛的
数据预处理
[De1CTF 2019]SSRF Me
The difference between abstract classes and interfaces (the most detailed)
![[GYCTF2020]Node Game](/img/8d/7e6c2fb2a0359298fbcc1cd8544710.png)








