当前位置:网站首页>Redis simple storage folder
Redis simple storage folder
2022-04-22 15:54:00 【Programmer hyperspace】
scene
redis database , Usually the storage format is as follows
Separate separately , No folders , It doesn't look beautiful

But I want to achieve this storage : Folder nature

Ways of realization : Namely key It's worth adding : Number
How to save double layers
.hset( 'user:zhangsan', 'user', {"name": "zhangsan", "age": 13, "addr": " Shanghai "})
How to save three layers Plus a colon
.hset( 'userinfo:shanghai:zhangsan', 'user', {"name": "zhangsan", "age": 13, "addr": " Shanghai "})
How to value
Bring a colon k Also do k that will do
hget('userinfo:shanghai:zhangsan', 'user')
.hget('user: Liu Yongxing ', 'user')
notes :key value , Chinese is not recommended , If you use Chinese, you won't be killed
Expiration time
establish String Type data , Be similar to redis-cli Medium set key value
set(name, value, ex=None, px=None, nx=False, xx=False)
Parameter meaning :
ex Expiration time ( second )
px Expiration time ( millisecond )
nx If set to True, only name When there is no , At present set Operation before execution , Otherwise, do not execute
xx If set to True, only name In existence , At present set Operation before execution , Otherwise, do not execute
setnx(name, value) Set the value , Only name When there is no , Perform the operation of adding settings
setex(name, value, time) Set value and expiration time ( Seconds or timedelta object )
psetex(name, time_ms, value) Set the expiration time ( Milliseconds or timedelta object )
版权声明
本文为[Programmer hyperspace]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221553461019.html
边栏推荐
- [in-depth understanding of tcallusdb technology] sample code for reading all data in the list - [list table]
- 太卷了~(2022版)大厂面经 + 详细笔记帮你搞定面试
- bluetoothGatt.disconnect()无效,还是保持着连接
- LeetCode每日一题——824. 山羊拉丁文
- Do you know how to generate random numbers? (over 3000 words)
- 制作的自媒体短视频很模糊?教你3个方法,让视频变清晰
- Frequently asked questions about recent BSN development
- SAP UI5 数据类型(data type) 学习笔记
- 引入文件路径问题-$_SERVER[‘DOCUMENT_ROOT‘]代表网站根目录
- jsquery.xxx.js和jsquery.xxx.min.js的区别
猜你喜欢
![[in depth understanding of tcallusdb technology] sample code of scanning data - [generic table]](/img/7b/8c4f1549054ee8c0184495d9e8e378.png)
[in depth understanding of tcallusdb technology] sample code of scanning data - [generic table]

OSPF的详细讲解、分类,还有实验讲解

MySQL operator explanation and regular expression query

Shell脚本中sed使用
![[in depth understanding of tcallusdb technology] example code - asynchronous call interface](/img/7b/8c4f1549054ee8c0184495d9e8e378.png)
[in depth understanding of tcallusdb technology] example code - asynchronous call interface

建筑业未来的发展方向:数字化工厂管理系统

制作的自媒体短视频很模糊?教你3个方法,让视频变清晰

4.21总结

Redis thread model

Spark基础学习笔记23:DataFrame与Dataset
随机推荐
For the professional development of teacher Guo, write down your experience
以前用淘宝助理备份的文件内的商品,全部重新上架到淘宝店铺
Talk about data subcontracting and related tips
制作的自媒体短视频很模糊?教你3个方法,让视频变清晰
AI智能视频技术如何应用在文物古迹建筑日常养护监管场景中?
[Kunpeng training camp] Chongqing 2022 developer competition
[二叉数]相同的树
Altium designer除了GND以外的Nets自动布线
企业级知识管理(KM)建设方法及过程
悟空的私藏「架构』书籍推荐
How redis solves the performance bottleneck caused by frequent command round trips!
396.旋转函数
【合泰HT32F52352定时器的使用】
[in depth understanding of tcallusdb technology] insert data example code - [generic table]
Is the account of digging money safe? How to handle it?
Redis optimization series (I) building redis master-slave based on docker
Wukong's private collection of "architecture" books recommended
OopMap理论篇
Construction method and process of enterprise level knowledge management (km)
bluetoothGatt.disconnect()无效,还是保持着连接