当前位置:网站首页>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 .
边栏推荐
- The ultimate experiment of OSPF -- learn the example of OSPF century template
- 【Matplotlib绘图】
- Sword finger offer II 115. reconstruction sequence
- Leetcode high frequency question 53. maximum subarray sum, continuous subarray with maximum sum, return its maximum sum
- [C language] address book (static version)
- Comment forcer complètement le meurtre de processus indépendants de l'arrière - plan?
- 记忆化搜索 - DP
- 121. The best time to buy and sell stocks
- Introduction and project development of MVVM and mvvmlight (I)
- fl studio 20.9更新中文版宿主DAW数字音频工作站
猜你喜欢

Introduction and project development of MVVM and mvvmlight (I)

Matlab wavelet toolbox import signal error (doesn't contain one dimensional single)

fl studio 20.9更新中文版宿主DAW数字音频工作站
![[golang learning notes] is parameter transfer in go language value transfer or reference transfer](/img/79/57b28d0e6501132c347f7e7c0516b3.png)
[golang learning notes] is parameter transfer in go language value transfer or reference transfer

巴菲特股东大会的启示 2021-05-06

Drools (1): introduction to drools

How to reasonably estimate the size of thread pool

El select drop-down box multi selection remote search anti display

Cookies and sessions

02. Supplement of knowledge related to web page structure
随机推荐
Array - 977. Square of ordered array
【Matplotlib绘图】
Cookies and sessions
Neo4j application
Excel password related
接口测试
JDBC programming of MySQL
Microsoft SQL Server database language and function usage (XIII)
torchvision.datasets.ImageFolder前的数据整理及使用方法
How can I open an account to buy financial products with a 6% income?
【golang学习笔记】flag包的简单使用,命令行解析
Programming in the novel [serial 20] the moon bends in the yuan universe
The ultimate experiment of OSPF -- learn the example of OSPF century template
What if the content of software testing is too simple?
Financial products with an annual yield of 6%
Matlab小波工具箱导入信号出错(doesn‘t contain one dimensional Singal)
MySQL的JDBC编程
[golang learning notes] concurrency basis
MySQL index transaction
el-select下拉框多选远程搜索反显