Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the difference among Jedis, Lettuce and Redisson in redis framework

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you what is the difference between Jedis, Lettuce and Redisson in the redis framework. I hope you will gain a lot after reading this article. Let's discuss it together.

Redis officially recommends more than a dozen encapsulation frameworks for Java language, mainly: Jedis, Lettuce, Redisson.

Comparison of several frames

All three frameworks encapsulate Redis operations in Java.

1. Jedis

Github: github.com/xetorthio/j...

Jedis is the client of Redis's Java implementation, and its API provides more comprehensive support for Redis commands. Basic data types such as String, Hash, List, Set and Sorted Set are supported.

Advantages: it comprehensively provides the operational features of Redis, which is more native than other Redis encapsulation frameworks.

Programming model: using blocked IMab O, method calls are synchronized, and the program flow can not be executed until the socket has finished processing it. Asynchronous operations are not supported. The Jedis client instance is not thread safe, so you need to use Jedis through connection pooling.

2. Lettuce

Official website: lettuce.io/github: github.com/lettuce-io/

Advanced Redis client for thread-safe synchronous, asynchronous and response use, supporting clustering, Sentinel, pipelines and encoders.

Advantages: suitable for distributed caching framework.

Programming model: an event-driven communication layer based on the Netty framework, where method calls are asynchronous. Lettuce's API is thread-safe, so you can manipulate a single Lettuce connection to accomplish various operations.

3.Redisson

Official website: redisson.org/github: github.com/redisson/re

Redisson implements a distributed and extensible Java data structure. Redisson not only provides a series of commonly used distributed Java objects, which can basically be common to the basic data structure of Java, but also provides many distributed services.

Advantages: promote the separation of users' attention to Redis, enable users to focus more on dealing with business logic, provide many distributed related operation services, such as distributed locks, distributed collections, and support delay queues through Redis.

Third-party framework integration:

Similar to the features of the Spring framework, configuring the RedissonClient instance and all the objects and services it supports in the namespace of Spring XML

The standard specification of Java cache is implemented on the basis of Redis, and the caching mechanism in Spring framework is fully implemented.

Provides an implementation of the Spring Session session manager

Programming model: an event-driven communication layer based on the Netty framework, where method calls are asynchronous. Redisson's API is thread-safe, so you can manipulate a single Redisson connection to accomplish various operations.

4. Summary

The method call in Jedis is relatively low-level exposed Redis's API, that is, the Java method in Jedis is basically consistent with Redis's API. If you understand the API of Redis, you will be able to use Jedis skillfully. On the other hand, the methods in Redisson are highly abstract, and each method call may make one or more Redis method calls.

After reading this article, I believe you have a certain understanding of the differences between Jedis, Lettuce and Redisson in the redis framework. If you want to know more about it, welcome to follow the industry information channel. Thank you for your reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report