Home  >  Article  >  Database  >  What are the redis frameworks?

What are the redis frameworks?

藏色散人
藏色散人Original
2019-06-11 16:42:104417browse

Redis officially recommends more than ten packaging frameworks for the Java language, mainly including: Jedis, Lettuce, and Redisson.

What are the redis frameworks?

Comparison of several frameworks

The three frameworks all encapsulate Redis operations in Java.

Recommended: "Redis Video Tutorial"

1. Jedis

github: github.com/xetorthio/j…

Jedis is the client of the Java implementation of Redis , its API provides relatively comprehensive support for Redis commands. Supports basic data types such as: String, Hash, List, Set, Sorted Set.

Advantages: It provides a comprehensive range of Redis operating features and is more native than other Redis encapsulation frameworks.

Programming model: Using blocking I/O, method calls are synchronized. The program flow needs to wait until the socket has processed the I/O before it can be executed. Asynchronous operations are not supported. Jedis client instances are not thread-safe, so you need to use Jedis through a connection pool.

2. Lettuce

官网:lettuce.io/
github: github.com/lettuce-io/…

Advanced Redis client for thread-safe synchronization, asynchronous and reactive usage, supports clustering, Sentinel, pipelines and encoders.

Advantages: Suitable for distributed cache framework.

Programming model: An event-driven communication layer based on the Netty framework, and its method calls are asynchronous. Lettuce's API is thread-safe, so a single Lettuce connection can be operated to complete various operations.

3.Redisson

官网: redisson.org/
github: github.com/redisson/re…

Redisson implements distributed and scalable Java data structures. Redisson not only provides a series of common distributed Java objects, which are basically common with Java's basic data structures, but also provides many distributed services.

Advantages: It prompts users to separate their attention from Redis, allowing users to focus more on processing business logic, and provides many distributed related operation services, such as distributed locks and distributed collections. , delay queues can be supported through Redis.

Third-party framework integration:

Provides features similar to those of the Spring framework, configuring the RedissonClient instance and its support in the namespace of Spring XML All objects and services

implement the Java cache standard specification based on Redis, and completely implement the caching mechanism in the Spring framework

Provides the implementation of the Spring Session session manager

Programming model: An event-driven communication layer based on the Netty framework, and its method calls are asynchronous. Redisson's API is thread-safe, so a single Redisson connection can be operated to complete various operations.

4. Summary

The method calls in Jedis are relatively low-level exposed Redis APIs, that is, the Java methods in Jedis are basically the same as the Redis APIs. Consistently, if you understand the Redis API, you will be able to use Jedis proficiently. The methods in Redisson are relatively high-level abstract, and each method call may make one or more Redis method calls.

The above is the detailed content of What are the redis frameworks?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What database is Redis?Next article:What database is Redis?