Why use spring Data Redis
The first is the client that the Spring Data Redis
Spring
Framework provides to operate Redis.
The spring framework is a full stack Java program framework that DI
AOP
provides a lightweight container and non-intrusive programming model support through, and portable service abstraction.
NoSQL Storage provides a scale-out and speed alternative to traditional relational databases, and Key-value storage is a key member of the current NoSQL world.
Spring Data Redis(SDR)
The framework enables the spring program to simply use Redis's key-value storage by eliminating redundant, repetitive, and integrated code.
Spring Data Redis currently supports two drivers: Jedis and lettuce, which can be seen as a unified package for both drives, shielding the operating details of the underlying driver in a highly uniform form, and providing a unified API to the user, with the following structure:
! [Hierarchical structure
Spring Data REDIS Monolithic structure
Spring Data Redis
Spring Data
other data operations with the family such as: Spring Data JDBC
, packaged in a similar structure, reduce the user's learning costs; as long as one of the Spring Data
techniques used, the other data source operation can be carried out according to the gourd, the overall structure of the package is as follows:
Divide the layer of encapsulation into 4 parts:
1) The bottom of the factory layer and the connection layer, here will be different depending on the driving implementation, the connection layer can directly Redis Server
interact with, using binary data and commands.
2) The template layer is a further encapsulation of the connection layer, which encapsulates an operation class for each data type of Redis, Redis Server
interacting with it, such as String
type, ValueOperations
and RedisTemplate
holding references to all types of operations, so that Redis can be manipulated directly by definition RedisTemplate
; RedisTemplate
encapsulates common operations, such as deleting keys, setting expiration time, and manipulating different data types through specific action classes.
3) Key binding layer is a further encapsulation of the template layer, each type of instance can only operate a single key value (the key has been specified when instantiating)
System Requirements and learning materials
Spring Data Redis
System requirements: Spring Data Redis 1.x to JDK 1.6 +, Redis 2.6.x +
Commonly used Redis Java clients are: Jedis, lettuce, Redison, Spring data Redis, the corresponding learning materials are as follows:
Jedis:https://github.com/xetorthio/jedis/wiki
Lettuce:https://github.com/lettuce-io/lettuce-core/wiki
Redison:https://github.com/redisson/redisson
spr:https://docs.spring.io/spring-data/redis/docs/2.0.2.release/reference/html/
More client references: http://www.redis.net.cn/clients/#java
Spring Data Redis Overview (i)