Redisson combines SpringCache to elegantly use cache Redisson uses cache in combination with SpringCache to control the cache time pom <dependency> <groupId>org.redisson</groupId> <artifactId>redisson-spring-boot-starter</artifactId> <version>3.21.1</version> </dependency> yaml spring: # redis interface and port configuration redis: redisson: host: 127.0.0.1 port: 6379 password: root timeout: 3000 #Connection timeout time config package com.config.redissonConfig; import lombok.Getter; import lombok.Setter; import org.redisson.api.RedissonClient; […]
Tag: redisson
RedissonLock Special Topic
1. Efficient distributed lock When we design distributed locks, we should consider at least some of the conditions that distributed locks must meet, and at the same time consider how to design distributed locks efficiently. Here I think the following points must be considered. 1. Mutually exclusive Under the conditions of distributed high concurrency, we […]
SpringBoot Chapter Integrating Jedis, Lettuce, and Redisson
Directory Preface 1. Detailed explanation of the differences between Jedis, Lettuce and Redisson 2. SpringBoot integration 2.1 Integrating Jedis 2.2 Integrating Lettuce 2.3 Integrating Redisson Summarize Foreword Hello everyone, I am AK. I am working on a new project recently, which is based on the modification of the old project framework. I also happen to […]
SpringBoot integrates Redisson
1. Redission integration 1. Create SpringBoot project Introducing SpringBoot’s redission starter: <dependency> <groupId>org.redisson</groupId> <artifactId>redisson-spring-boot-starter</artifactId> <version>3.15.5</version> </dependency> View jar package related dependencies 2. Configure redission 1) Add the redission configuration file path in application.yml spring: redis: database: 0 timeout: 3000 password: # Single node mode host: 127.0.0.1 port: 6379 # redisson configuration file path redisson: file: […]
Code implementation of distributed lock based on Redisson framework
Foreword: You must have a good understanding of the process of implementing distributed locks in redis Origin of distributed lock: For example, for an inventory deduction operation, redis deduction, there will be no problem if synchronized is added to the JVM stand-alone machine and it is queued for execution. However, in distributed mode, even if […]
Redisson-distributed objects
Each Redisson object instance will have a corresponding Redis data instance. You can obtain the name (key) of the Redis data instance by calling the getName method. RMap map = redisson.getMap(“mymap”); map.getName(); // = mymap All operations related to Redis key are summarized in the RKeys interface: RKeys keys = redisson.getKeys(); Iterable<String> allKeys = keys.getKeys(); […]
One article on distributed coordination Redis client-Redisson
Redisson 1. Introduction Redisson – is an advanced distributed coordination Redis client, focusing on distributed system development, allowing users to easily use Redis in distributed systems. 2. Related uses 1. Lock //The bottom layer is Lua script to ensure the atomicity of locking // Wait to acquire the lock until the lock is obtained! The […]
redisson springboot configuration
pom <!–redisson–> <dependency> <groupId>org.redisson</groupId> <artifactId>redisson-spring-boot-starter</artifactId> <version>3.20.1</version> </dependency> <dependency> <groupId>cn.hutool</groupId> <artifactId>hutool-extra</artifactId> <version>5.8.18</version> </dependency> YML — spring: redis: # address host: 192.168.1.243 #Port, default is 6379 port: 6379 # Database index database: 6 # Password (please comment out if there is no password) # password: #Connection timeout timeout: 10s # Whether to enable ssl ssl: false Configuration […]
14. Redisson distributed lock
Spring Cloud microservices series of articles, click above to collect↑ 1. Beginning In a single application, we can use Java’s synchronized or lock to use locks, but in a microservice scenario, an application will deploy multiple instances, which requires To ensure that multiple threads of multiple instances can only have one thread operating resources at […]
Redis Improvement Chapter: Redisson
1. Introduction Redis supports three commonly used clients: jedis, lettuce, and redisson. Among them, their respective characteristics are as follows: jedis: Provides relatively comprehensive redis command support, but it uses blocking I/O, and method calls are all synchronous. The program flow needs to wait until the socket has processed the I/O before it can be […]