当前位置:网站首页>redis 数据类型
redis 数据类型
2022-07-24 18:33:00 【51CTO】
redis数据类型一共有五种,包括-string、-list、-set、-sort set、-hash
简单的使用介绍
-string
string 为最简单的类型, 与Memcached一样的类型,一个key对应一个value,其支持的操作与Memcached的操作类似,它的功能更丰富,设置可以存二进制的对象。
在redis的目录下执行 redis-cli 即可进入 redis的命令行(没设置密码的情况下可以直接进入)
例子: 存string类型的数据
-list
list 是一个链表结构,主要功能是push,pop获取一个范围的所有值等等,操作中key理解为链表的名字
使用list结构,可以轻松的实现最新消息的排行等功能,list的另一个应用就是消息队列,可以利用list的push操作将任务存在list中,然后工作线程再用pop操作将任务取出进行执行
可以理解为 push 为压进去 pop为取出来
使用格式为 LPUSH 、 LPOP
例子:
-set
set 是集合对集合的操作有添加删除元素,有对多个集合求交并差等操作,操作中key理解为集合的名字
例子:
-sort set
sort set 是有序集合 它比set 多了一个score 使得集合中的元素能够昂score进行有序排序
例子:
-hash
hash 在Memcached中 我们经常将一些结构化的信息打包成hashmap,在客户端序列化后存储成一个字符串的值 ,(一般是JSON格式)
例子:
边栏推荐
猜你喜欢

Ionic4 learning notes 5-- custom public module

Mysql——》BufferPool相关信息

开窗函数(1)-部门工资前三员工

pycharm配置opencv库

JMeter -- silent operation

Typora is still the most beautiful and beautiful document editing artifact of yyds in my heart. I believe you will never abandon it

Windowing function (1) - top three employees of department salary

全国职业院校技能大赛网络安全竞赛——Apache安全配置详解

9. BOM object?

Ionic4 learning notes 4 -- add a tab page
随机推荐
空间三点画圆代码
Ionic4 learning notes 10 rotation map of an East Project
Typora 它依然是我心中的YYDS 最优美也是颜值最高的文档编辑神器 相信你永远不会抛弃它
下拉列表组件使用 iScroll.js 实现滚动效果遇到的坑
Generate publickey with der format public key and report an error
Four ways of simple interest mode
EasyUI framework dialog repeated loading problem
Ionic4 learning notes 9 -- an east project 01
7. Character coding?
颜色的13 个必备方法!
Web penetration experience summary ing
epoch,batch_ size
理解corners_align,两种看待像素的视角
KiB、MiB与KB、MB的区别
jmeter -- prometheus+grafana服务器性能可视化
Ionic4 learning notes 5-- custom public module
Encapsulate function basedata.js
Go language file operation
A practical scheme of realizing 0.5px on mobile terminal
Tree chain partition board