当前位置:网站首页>Crazy God redis notes 10
Crazy God redis notes 10
2022-07-23 22:34:00 【Matcha flavored watermelon juice】

We'll build a new one for springboot and redis A module of integration :

Then we rely on the guide , Start writing our code :

We also need to write our configuration file first :

test :
In order to prevent Chinese garbled code and other problems , We can also create it ourselves redistemplate Configuration class :
Creating is a user Entity class :
At present, it has not been serialized .

![]()

Run the test :
![]()
It can be tested normally .
We don't have to json Format , Directly in the form of our class object :

There may be an error that there is no serialization , Although I did not report any errors when writing code , So we can add serialization to entity classes :
Many of our enterprises pojo Classes will be instantiated .
This code is a fixed template , We can use it directly in the future .
We can use this annotation to specify our own redistemplate, Not the official .
We found it this way key Is the form of a separate string , There may be garbled code when using official .
We are in the enterprise 90% The probability will not use the native way to write redis command , Instead, use what you create util Tool class implementation , So we can write one by ourselves :
I won't put this here , It's also available online , Crazy God's video also has , Just use it as a template .
When using, first inject redisUtil.
Then we use it in the test method :
This redisutil It also contains all of our redis The order of , You can use it directly .
test result :
Redis.conf Detailed explanation :
Our default is RDB, Generally, we don't need to modify .
Then we'll test it :
Let's delete this dump.rdb file :
We can also see that our default is rdb.
When we 5 After writing the add command :

Will automatically generate our rdb file .
Let's delete it again rdb file :
We carry out flushall after :

You can still find our file .

Check where you want to store it :
If this directory exists rdb file , After startup, its data will be restored by default .
Almost its own configuration is enough , But we will still learn .
Sometimes we put this in the production environment rdb File backup !

Finally, we need to restore the configuration we just changed to the default .
边栏推荐
- 小说里的编程 【连载之十七】元宇宙里月亮弯弯
- TikTok推出多语种字幕和翻译工具
- Yolo7 mask recognition practice
- Array - 977. Square of ordered array
- LeetCode高频题62. 不同路径:机器人从左上角到右下角的路径有多少条?纯概率排列组合问题,而不是动态规划题
- el-select下拉框多选远程搜索反显
- ES6 use of arrow function
- Notes on network segment CIDR
- $, $*, [email protected], $$ Understand the meaning of 0
- Basic syntax of MySQL DDL and DML and DQL
猜你喜欢

糖尿病遗传风险检测挑战赛Baseline

DeFi项目的盈利逻辑 2021-04-26

zk 是如何解决脑裂问题的

Inspiration from Buffett's shareholders' meeting 2021-05-06

Taobao assistant is disabled. What is the reason for using the big Taoying import data package to upload the baby prompt "the main image is required and cannot be empty"? How to solve it?

D1-H 开发板——哪吒 开发入门

糖尿病遗传风险检测挑战赛进阶

使用itextpdf提取PDF文件中的任意页码

Crazy bull market, where to go in the second half? 2021-04-30

Yolo7 mask recognition practice
随机推荐
如何彻底强制杀死后台无关进程?
Array -- 27. remove elements
D2admin framework is basically used
Programming in the novel [serial 18] the moon bends in the yuan universe
Introduction and project development of MVVM and mvvmlight (I)
What are the product life cycle, common project functions, and information flow
El select drop-down box multi selection remote search anti display
Mqtt connection, subscription and publishing can be realized without mqtt C library
MySQL index transaction
02. Supplement of knowledge related to web page structure
小说里的编程 【连载之二十】元宇宙里月亮弯弯
Tiktok launches multilingual subtitles and translation tools
如何在 pyqt 中实现桌面歌词
Use of cjson Library
激光雷达点云数据录制的rosbag文件转换成csv文件
Record the process of the first excavation and intersection
小说里的编程 【连载之十九】元宇宙里月亮弯弯
DeFi项目的盈利逻辑 2021-04-26
Rails搭配OSS最佳实践
el-select下拉框多选远程搜索反显