当前位置:网站首页>[redis] key hierarchy
[redis] key hierarchy
2022-06-29 01:58:00 【Riding a snail chasing a missile '】
List of articles
Key Hierarchical structure
reflection
Redis There's nothing like MySQL Medium table Concept , How can we distinguish between different types of key Well ?
- for example : Need to store users 、 Product information to redis in , There's a user id yes 1, There is a commodity id It happens to be 1.
Redis Of key Multiple words are allowed to form a hierarchy , Use... Between multiple words : separate , The format is as follows : Project name : Business name : type :id, This format is not fixed , You can delete or add entries according to your own needs .
userdependent key ->zyx:user:1productdependent key ->zyx:product:1
If value It's a java object , For example, one User object , You can serialize the object to JSON Store after string :

Using the above ideas, we are Redis Store two... In User Object data and two Product Object data :
127.0.0.1:6379[2]> SET zyx:user:1 '{"id":1, "name":"Jack", "age": 21}'
OK
127.0.0.1:6379[2]> SET zyx:user:2 '{"id":1, "name":"Rose", "age": 18}'
OK
127.0.0.1:6379[2]> SET zyx:product:1 '{"id":1, "name":" millet 11", "price": 4999}'
OK
127.0.0.1:6379[2]> SET zyx:product:2 '{"id":2, "name":" glory 6", "price": 2999}'
OK
127.0.0.1:6379[2]> KEYS *
1) "zyx:product:2"
2) "zyx:user:2"
3) "zyx:user:1"
4) "zyx:product:1"
When we open it through the graphical interface, we can clearly find our stored User、Product Object data is classified into files , Implements a hierarchical structure :

边栏推荐
- 4276. good at C
- Advanced installer architect authoring tool
- Server antivirus
- 如何成为一名高级数字 IC 设计工程师(3-5)工具篇:SpyGlass 技术
- How to become a senior digital IC Design Engineer (1-1) Verilog coding Grammar: Introduction
- Configurable FFT system design based on risc-v SOC (1) Introduction
- Near's storage stacking
- 如何成为一名高级数字 IC 设计工程师(6-7)数字 IC 验证篇:DEBUG 技巧
- Typescript (5) class, inheritance, polymorphism
- [learn FPGA programming from scratch -49]: Vision - how is the chip designed?
猜你喜欢

How to encrypt anti copy program

【Redis】Set类型

How to use PN junction to measure temperature?

基于 RISC-V SoC 的可配置 FFT 系统设计(1)引言

如何成为一名高级数字 IC 设计工程师(4-3)脚本篇:C 语言实现的文件读写操作

独家分析 | 软件测试关于简历和面试的真实情况

How to become a senior digital IC Design Engineer (4-2) script: file read / write operation realized by Verilog HDL code

Exclusive analysis | real situation of software test about resume and interview

Near consensus mechanism

Analysis of advantages and disadvantages of environment encryption and transparent encryption
随机推荐
Ambiguity between 0 and 1
Analysis of advantages and disadvantages of environment encryption and transparent encryption
[learn FPGA programming from scratch -50]: Vision - how are chips made? The thirteen steps of chip manufacturing.
如何成为一名高级数字 IC 设计工程师(4-5)脚本篇:Shell 脚本实现的文件比较操作
How to become a senior digital IC Design Engineer (4-2) script: file read / write operation realized by Verilog HDL code
如何成为一名高级数字 IC 设计工程师(6-6)数字 IC 验证篇:系统级仿真
[solution] longest common subsequence
【Redis】SortedSet类型
利用kubernetes資源鎖完成自己的HA應用
Testing until you're 35? The 35 + test will lead to unemployment?
HBuilder左侧工具栏不见了
直播预告|SQL也能玩转工业级机器学习?MLOps meetup V3带你一探究竟!
Query any field of any table in JPA to the util method of entity class dto
Business system anti-virus
想请教一下,如何选择券商?现在网上开户安全么?
[high concurrency, high performance and high availability of massive data MySQL practice-10] - Implementation of mvcc in InnoDB
Near's storage stacking
How to become a senior digital IC Design Engineer (6-7) digital IC Verification: debug skills
ASP. Net based on LAN
Scala Foundation (3): Operators and Process Control