当前位置:网站首页>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格式)
例子:
边栏推荐
- [verification] only numbers (positive and negative numbers) can be entered
- MySQL - bufferpool related information
- Revocable search board
- 6. How to add an array in Es5?
- epoch,batch_ size
- Rookie colleagues cost me 2K. Did you recite the secret of salary increase? (collect it quickly!)
- 6126. Design food scoring system
- Web penetration experience summary ing
- Escape character in JS?
- undefined reference to H5PTopen
猜你喜欢

全国职业院校技能大赛网络安全竞赛之数据分析数字取证-A

How to solve the problem that yaml in idea is unrecognized or red?

5. Reference type and value type as function parameters?

Ionic4 learning notes 3

Calling startActivity() from outside of an Activity context requires the FLAG_ ACTIVITY_ NEW_ TASK flag

模拟实现vector

理解corners_align,两种看待像素的视角

Cf. bits and pieces (subset pressing DP + pruning)

Ionic4 learning notes 8 -- UI component 2 list (no practice, direct excerpt)

Maximum sum and promotion of continuous subarrays (2)
随机推荐
Namespace: cluster environment sharing and isolation
The drop-down list component uses iscrol JS to achieve the rolling effect of the pit encountered
Segment tree merge board
jmeter -- prometheus+grafana服务器性能可视化
ORM introduction and database operation
Getaverse,走向Web3的远方桥梁
全国职业院校技能大赛网络安全竞赛——Apache安全配置详解
Common methods of array (2)
[opencv] - thresholding
球面上绘制圆matlab仿真
6. How to add an array in Es5?
CF lomsat gelral (heuristic merge)
Maximum sum and promotion of continuous subarrays (2)
redis集群的三种方式
IO multiplexing
QT - animation frame
Web penetration experience summary ing
We have to understand the four scopes: application, session, request and page
【校验】只能输入数字(正负数)
Techempower web framework performance test 21st round results release --asp Net core continue to move forward