Redisson basic usage
1. Redisson
Redisson is the Java version of redis client officially recommended by redis. It provides many functions and is very powerful. Here we only use its distributed lock function.
https://github.com/redisson/redisson
1.1. Basic Usage
1.2. Distributed locks and synchronizers
Redisson client provides many kinds of locks and many other practical methods
1.2. 1. Lock
Default, unfair lock
The simplest way
Specify timeout
asynchronous
1.2. 2 Fair Lock
1.2. 3 MultiLock
1.2. 4 RedLock
1.3. Example
pom. xml
application. yml
RedissonConfig. java
CourseServiceImpl. java
StockServiceImpl. java
OrderServiceImpl. java
OrderModel. java
Database script sql
1.4 engineering structure
https://github.com/chengjiansheng/cjs-redisson-example
1.5 redis cluster creation
1.6 testing
Test / course / upload
Test / order / create
2. Spring Integration
The usage is similar to redisson
3. Others
https://github.com/redisson/redisson/wiki/8.-Distributed-locks-and-synchronizers
https://www.cnblogs.com/cjsblog/p/9831423.html