提交 83f10b12 编写于 作者: N Nikita Koksharov

Merge branch 'master' of github.com:redisson/redisson

......@@ -4,6 +4,25 @@ Redisson Releases History
Сonsider __[Redisson PRO](https://redisson.pro)__ version for advanced features and support by SLA.
### 29-Apr-2019 - versions 3.10.7 released
Feature - Add support for [Reactive and RxJava2 interfaces](https://github.com/redisson/redisson/wiki/9.-distributed-services#913-remote-service-asynchronous-reactive-and-rxjava2-calls) to RemoteService object
Feature - MILLISECONDS option added to RRateLimiter.RateIntervalUnit object
Feature - range method added to RList, RListReactive and RListRx interfaces
Improvement - `JCache.getAll` execution optimization for non-existing keys
Improvement - 10X Performance boost for `JCache.putAll` method
Fixed - disconnected sentinels shouldn't be used in sentinel list
Fixed - Apache Tomcat `RedissonSessionManager` doesn't use classloader aware codec for session Map object (thanks to [jchobantonov](https://github.com/jchobantonov))
Fixed - LiveObject field with Map type couldn't be persisted
Fixed - `RRateLimiter` allows permits limit exceeding
Fixed - `CompositeCodec.getMapValueDecoder` method uses `MapKeyDecoder` instead of `MapValueDecoder`
Fixed - memory leak during blocking methods invocation of Queue objects
Fixed - Apache Tomcat `RedissonSessionManager.findSession` shouldn't create a new one session (thanks to [jchobantonov](https://github.com/jchobantonov))
Fixed - `JCache.removeAll` method doesn't notify Cache listeners
Fixed - `UpdateValve` sould be removed from pipeline in Apache Tomcat `RedissonSessionManager.stopInternal` method (thanks to [jchobantonov](https://github.com/jchobantonov))
Fixed - Redis Sentinel prior 5.0.1 version doesn't require password. Regression since 3.10.5 version
Fixed - Redisson tries to renewed Lock expiration even if lock doesn't exist. Regression since 3.10.5 version
Fixed - FstCodec can't deserialize ConcurrentHashMap based object with package visibility
### 05-Apr-2019 - versions 3.10.6 released
Feature - `broadcastSessionEvents` setting added to Tomcat Session Manager
Feature - `remainTimeToLive` method added to `RLock`, `RLockAsync`, `RLockRx` and `RLockReactive` interfaces
......
# Redisson - Redis Java client<br/>with features of In-Memory Data Grid
[Quick start](https://github.com/redisson/redisson#quick-start) | [Documentation](https://github.com/redisson/redisson/wiki) | [Javadocs](http://www.javadoc.io/doc/org.redisson/redisson/3.10.5) | [Changelog](https://github.com/redisson/redisson/blob/master/CHANGELOG.md) | [Code examples](https://github.com/redisson/redisson-examples) | [FAQs](https://github.com/redisson/redisson/wiki/16.-FAQ) | [Report an issue](https://github.com/redisson/redisson/issues/new) | **[Redisson PRO](https://redisson.pro)**
[Quick start](https://github.com/redisson/redisson#quick-start) | [Documentation](https://github.com/redisson/redisson/wiki) | [Javadocs](http://www.javadoc.io/doc/org.redisson/redisson/3.10.6) | [Changelog](https://github.com/redisson/redisson/blob/master/CHANGELOG.md) | [Code examples](https://github.com/redisson/redisson-examples) | [FAQs](https://github.com/redisson/redisson/wiki/16.-FAQ) | [Report an issue](https://github.com/redisson/redisson/issues/new) | **[Redisson PRO](https://redisson.pro)**
Based on high-performance async and lock-free Java Redis client and [Netty](http://netty.io) framework.
JDK compatibility: 1.8 - 12, Android
......@@ -103,12 +103,12 @@ Used by
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson</artifactId>
<version>3.10.6</version>
<version>3.10.7</version>
</dependency>
#### Gradle
compile 'org.redisson:redisson:3.10.6'
compile 'org.redisson:redisson:3.10.7'
#### Java
......@@ -134,8 +134,8 @@ Consider __[Redisson PRO](https://redisson.pro)__ version for advanced features
## Downloads
[Redisson 3.10.6](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.redisson&a=redisson&v=3.10.6&e=jar),
[Redisson node 3.10.6](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.redisson&a=redisson-all&v=3.10.6&e=jar)
[Redisson 3.10.7](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.redisson&a=redisson&v=3.10.7&e=jar),
[Redisson node 3.10.7](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.redisson&a=redisson-all&v=3.10.7&e=jar)
## FAQs
......
Redis based Hibernate Cache implementation
===
# Redis based Hibernate Cache implementation
Implements [Hibernate 2nd level Cache](https://docs.jboss.org/hibernate/orm/5.4/userguide/html_single/Hibernate_User_Guide.html#caching) provider based on Redis.
Supports all Hibernate cache strategies: `READ_ONLY`, `NONSTRICT_READ_WRITE`, `READ_WRITE` and `TRANSACTIONAL`.
Implements [Hibernate 2nd level Cache](https://docs.jboss.org/hibernate/orm/5.4/userguide/html_single/Hibernate_User_Guide.html#caching) provider based on Redis.
Supports all Hibernate cache strategies: `READ_ONLY`, `NONSTRICT_READ_WRITE`, `READ_WRITE` and `TRANSACTIONAL`.
It's recommended to use FST or Snappy as [codec](https://github.com/redisson/redisson/wiki/4.-data-serialization).
Compatible with Hibernate 4.x, 5.x. (5.3.0, 5.3.1 and 5.3.2 versions aren't supported)
Redisson provides various Hibernate Cache factories including those with features below:
**local cache** - so called `near cache`, which is useful for use cases when Hibernate Cache used mostly for read operations and/or network roundtrips are undesirable. It caches Map entries on Redisson side and executes read operations up to **5x faster** in comparison with common implementation. All local caches with the same name connected to the same pub/sub channel which is used for messaging between them. In particular to send entity update or entity invalidate event.
**local cache** - so called `near cache`, which is useful for use cases when Hibernate Cache used mostly for read operations and/or network roundtrips are undesirable. It caches Map entries on Redisson side and executes read operations up to **5x faster** in comparison with common implementation. All local caches with the same name connected to the same pub/sub channel which is used for messaging between them. In particular to send entity update or entity invalidate event.
**data partitioning** - data partitioning in cluster mode. It allows to scale available memory, read/write operations and entry eviction process for individual Hibernate Cache instance in Redis cluster.
**data partitioning** - data partitioning in cluster mode. It allows to scale available memory, read/write operations and entry eviction process for individual Hibernate Cache instance in Redis cluster.
Below is the list of all available factories with local cache and/or data partitioning support:
Below is the list of all available factories with local cache and/or data partitioning support:
|Class name | Local cache <br/> support<br/>(up to 5x faster) | Data partitioning <br/> support |
| ------------- | ------------- | ------------|
......@@ -22,12 +21,12 @@ Below is the list of all available factories with local cache and/or data partit
|RedissonClusteredRegionFactory<br/><sub><i>available only in [Redisson PRO](http://redisson.pro) edition</i></sub> | No | **Yes** |
|RedissonClusteredLocalCachedRegionFactory<br/><sub><i>available only in [Redisson PRO](http://redisson.pro) edition</i></sub> | **Yes** | **Yes** |
Hibernate Cache Usage
===
## Hibernate Cache Usage
### 1. Add `redisson-hibernate` dependency into your project:
### 1. Add `redisson-hibernate` dependency into your project:
Maven
```xml
<dependency>
<groupId>org.redisson</groupId>
......@@ -45,7 +44,7 @@ Maven
Gradle
```java
```groovy
// for Hibernate v4.x
compile 'org.redisson:redisson-hibernate-4:3.10.6'
// for Hibernate v5.0.x - v5.1.x
......@@ -54,8 +53,7 @@ Gradle
compile 'org.redisson:redisson-hibernate-52:3.10.6'
// for Hibernate v5.3.3+ - v5.4.x
compile 'org.redisson:redisson-hibernate-53:3.10.6'
```
```
### 2. Specify hibernate cache settings
......@@ -71,7 +69,9 @@ Define Redisson Region Cache Factory:
<!-- or -->
<property name="hibernate.cache.region.factory_class" value="org.redisson.hibernate.RedissonClusteredLocalCachedRegionFactory" />
```
By default each Region Factory creates own Redisson instance. For multiple applications, using the same Redis setup and deployed in the same JVM, amount of Redisson instances could be reduced using JNDI registry:
```xml
<!-- name of Redisson instance registered in JNDI -->
<property name="hibernate.cache.region.jndi_name" value="redisson_instance" />
......@@ -96,33 +96,33 @@ By default each Region Factory creates own Redisson instance. For multiple appli
<property name="hibernate.cache.redisson.config" value="/redisson.json" />
```
#### Redisson allows to define follow cache settings per entity, collection, naturalid, query and timestamp regions:
#### Redisson allows to define follow cache settings per entity, collection, naturalid, query and timestamp regions:
`hibernate.cache.redisson.[REGION_NAME].eviction.max_entries` - max size of cache. Superfluous entries in Redis are evicted using LRU algorithm. `0` value means unbounded cache. Default value: 0
`hibernate.cache.redisson.[REGION_NAME].eviction.max_entries` - max size of cache. Superfluous entries in Redis are evicted using LRU algorithm. `0` value means unbounded cache. Default value: 0
`hibernate.cache.redisson.[REGION_NAME].expiration.time_to_live` - time to live per cache entry in Redis. Defined in milliseconds. `0` value means this setting doesn't affect expiration. Default value: 0
`hibernate.cache.redisson.[REGION_NAME].expiration.time_to_live` - time to live per cache entry in Redis. Defined in milliseconds. `0` value means this setting doesn't affect expiration. Default value: 0
`hibernate.cache.redisson.[REGION_NAME].expiration.max_idle_time` - max idle time per cache entry in Redis. Defined in milliseconds. `0` value means this setting doesn't affect expiration. Default value: 0
`hibernate.cache.redisson.[REGION_NAME].expiration.max_idle_time` - max idle time per cache entry in Redis. Defined in milliseconds. `0` value means this setting doesn't affect expiration. Default value: 0
`hibernate.cache.redisson.[REGION_NAME].localcache.max_idle_time` - max idle time per entry in local cache. Defined in milliseconds. `0` value means this setting doesn't affect expiration. Default value: 0
`hibernate.cache.redisson.[REGION_NAME].localcache.max_idle_time` - max idle time per entry in local cache. Defined in milliseconds. `0` value means this setting doesn't affect expiration. Default value: 0
`hibernate.cache.redisson.[REGION_NAME].localcache.time_to_live` - time to live per entry in local cache. Defined in milliseconds. `0` value means this setting doesn't affect expiration. Default value: 0
`hibernate.cache.redisson.[REGION_NAME].localcache.time_to_live` - time to live per entry in local cache. Defined in milliseconds. `0` value means this setting doesn't affect expiration. Default value: 0
`hibernate.cache.redisson.[REGION_NAME].localcache.eviction_policy` - eviction policy applied to local cache entries when cache size limit reached. LFU, LRU, SOFT, WEAK and NONE policies are available. Default value: NONE
`hibernate.cache.redisson.[REGION_NAME].localcache.eviction_policy` - eviction policy applied to local cache entries when cache size limit reached. LFU, LRU, SOFT, WEAK and NONE policies are available. Default value: NONE
`hibernate.cache.redisson.[REGION_NAME].localcache.sync_strategy` - sync strategy used to synchronize local cache changes across all instances. Follow sync strategies are available:
INVALIDATE - Default. Invalidate cache entry across all LocalCachedMap instances on map entry change
UPDATE - Update cache entry across all LocalCachedMap instances on map entry change
NONE - No synchronizations on map changes
`hibernate.cache.redisson.[REGION_NAME].localcache.sync_strategy` - sync strategy used to synchronize local cache changes across all instances. Follow sync strategies are available:
INVALIDATE - Default. Invalidate cache entry across all LocalCachedMap instances on map entry change
UPDATE - Update cache entry across all LocalCachedMap instances on map entry change
NONE - No synchronizations on map changes
Default value: INVALIDATE
`hibernate.cache.redisson.[REGION_NAME].localcache.reconnection_strategy` - reconnection strategy used to load missed updates through Hibernate during any connection failures to Redis. Since, local cache updates can't be get in absence of connection to Redis. Follow reconnection strategies are available:
CLEAR - Clear local cache if map instance has been disconnected for a while.
LOAD - Store invalidated entry hash in invalidation log for 10 minutes. Cache keys for stored invalidated entry hashes will be removed if LocalCachedMap instance has been disconnected less than 10 minutes or whole cache will be cleaned otherwise.
NONE - Default. No reconnection handling
`hibernate.cache.redisson.[REGION_NAME].localcache.reconnection_strategy` - reconnection strategy used to load missed updates through Hibernate during any connection failures to Redis. Since, local cache updates can't be get in absence of connection to Redis. Follow reconnection strategies are available:
CLEAR - Clear local cache if map instance has been disconnected for a while.
LOAD - Store invalidated entry hash in invalidation log for 10 minutes. Cache keys for stored invalidated entry hashes will be removed if LocalCachedMap instance has been disconnected less than 10 minutes or whole cache will be cleaned otherwise.
NONE - Default. No reconnection handling
Default value: NONE
Default value: NONE
`hibernate.cache.redisson.[REGION_NAME].localcache.size` - max size of local cache. Superfluous entries in Redis are evicted using defined eviction policy. `0` value means unbounded cache. Default value: 0
......
Spring Boot Starter
===
# Spring Boot Starter
Integrates Redisson with Spring Boot library. Depends on [Spring Data Redis](https://github.com/redisson/redisson/tree/master/redisson-spring-data#spring-data-redis-integration) module.
......@@ -7,10 +6,9 @@ Supports Spring Boot 1.3.x, 1.4.x, 1.5.x, 2.0.x, 2.1.x
<sub>Consider __[Redisson PRO](https://redisson.pro)__ version for advanced features and support by SLA.</sub>
Usage
===
## Usage
### 1. Add `redisson-spring-boot-starter` dependency into your project:
### 1. Add `redisson-spring-boot-starter` dependency into your project:
Maven
......@@ -23,9 +21,10 @@ Maven
```
Gradle
```java
```groovy
compile 'org.redisson:redisson-spring-boot-starter:3.10.6'
```
```
### 2. Add settings into `application.settings` file
......
Spring Data Redis integration
===
# Spring Data Redis integration
Integrates Redisson with Spring Data Redis library. Implements Spring Data's `RedisConnectionFactory` and `ReactiveRedisConnectionFactory` interfaces and allows to interact with Redis through `RedisTemplate` or `ReactiveRedisTemplate` object.
......@@ -7,10 +6,9 @@ Supports Spring Data Redis 1.6.x, 1.7.x, 1.8.x, 2.0.x, 2.1.x
<sub>Consider __[Redisson PRO](https://redisson.pro)__ version for advanced features and support by SLA.</sub>
Usage
===
## Usage
### 1. Add `redisson-spring-data` dependency into your project:
### 1. Add `redisson-spring-data` dependency into your project:
Maven
......@@ -33,7 +31,7 @@ Maven
Gradle
```java
```groovy
// for Spring Data Redis v.1.6.x
compile 'org.redisson:redisson-spring-data-16:3.10.6'
// for Spring Data Redis v.1.7.x
......@@ -44,24 +42,24 @@ Gradle
compile 'org.redisson:redisson-spring-data-20:3.10.6'
// for Spring Data Redis v.2.1.x
compile 'org.redisson:redisson-spring-data-21:3.10.6'
```
```
### 2. Register `RedissonConnectionFactory` in Spring context
```java
```java
@Configuration
public class RedissonSpringDataConfig {
@Bean
public RedissonConnectionFactory redissonConnectionFactory(RedissonClient redisson) {
return new RedissonConnectionFactory(redisson);
}
@Bean(destroyMethod = "shutdown")
public RedissonClient redisson(@Value("classpath:/redisson.yaml") Resource configFile) throws IOException {
Config config = Config.fromYAML(configFile.getInputStream());
return Redisson.create(config);
}
}
```
Redis based Tomcat Session Manager
===
# Redis based Tomcat Session Manager
Stores session of [Apache Tomcat](http://tomcat.apache.org) in Redis and allows to distribute requests across a cluster of Tomcat servers. Implements non-sticky session management backed by Redis.
Stores session of [Apache Tomcat](http://tomcat.apache.org) in Redis and allows to distribute requests across a cluster of Tomcat servers. Implements non-sticky session management backed by Redis.
Supports Apache Tomcat 6.x, 7.x, 8.x, 9.x
<sub>Consider __[Redisson PRO](https://redisson.pro)__ version for advanced features and support by SLA.</sub>
Advantages
===
## Advantages
Current implementation differs from any other Redis based Tomcat Session Manager in terms of efficient storage and optimized writes. Each session attribute is written into Redis during each `HttpSession.setAttribute` invocation. While other solutions serialize whole session each time.
Usage
===
## Usage
### 1. Add `RedissonSessionManager`
Add `RedissonSessionManager` into `tomcat/conf/context.xml`
```xml
<Manager className="org.redisson.tomcat.RedissonSessionManager"
configPath="${catalina.base}/redisson.conf"
......@@ -28,9 +25,9 @@ Add `RedissonSessionManager` into `tomcat/conf/context.xml`
* `MEMORY` - stores attributes into local Tomcat Session and Redis. Further Session updates propagated to local Tomcat Session using Redis-based events.
* `REDIS` - stores attributes into Redis only. Default mode.
<br/>
`broadcastSessionEvents` - if `true` then `sessionCreated` and `sessionDestroyed` events broadcasted across all Tomcat instances and trigger all registered HttpSessionListeners. Default is `false`.
`updateMode` - Session attributes update mode. Two modes are available:
* `DEFAULT` - session attributes are stored into Redis only through setAttribute method. Default mode.
* `AFTER_REQUEST` - all session attributes are stored into Redis after each request.
......@@ -46,7 +43,7 @@ Add `RedissonSessionManager` into `tomcat/conf/context.xml`
```xml
<GlobalNamingResources>
<Resource name="bean/redisson"
<Resource name="bean/redisson"
auth="Container"
factory="org.redisson.JndiRedissonFactory"
configPath="${catalina.base}/conf/redisson.yaml"
......@@ -67,15 +64,16 @@ Add `RedissonSessionManager` into `tomcat/conf/context.xml`
```
### 2. Copy two jars into `TOMCAT_BASE/lib` directory:
[redisson-all-3.10.6.jar](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.redisson&a=redisson-all&v=3.10.6&e=jar)
[redisson-all-3.10.7.jar](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.redisson&a=redisson-all&v=3.10.7&e=jar)
for Tomcat 6.x
[redisson-tomcat-6-3.10.6.jar](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.redisson&a=redisson-tomcat-6&v=3.10.6&e=jar)
[redisson-tomcat-6-3.10.7.jar](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.redisson&a=redisson-tomcat-6&v=3.10.7&e=jar)
for Tomcat 7.x
[redisson-tomcat-7-3.10.6.jar](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.redisson&a=redisson-tomcat-7&v=3.10.6&e=jar)
[redisson-tomcat-7-3.10.7.jar](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.redisson&a=redisson-tomcat-7&v=3.10.7&e=jar)
for Tomcat 8.x
[redisson-tomcat-8-3.10.6.jar](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.redisson&a=redisson-tomcat-8&v=3.10.6&e=jar)
[redisson-tomcat-8-3.10.7.jar](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.redisson&a=redisson-tomcat-8&v=3.10.7&e=jar)
for Tomcat 9.x
[redisson-tomcat-9-3.10.6.jar](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.redisson&a=redisson-tomcat-9&v=3.10.6&e=jar)
[redisson-tomcat-9-3.10.7.jar](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.redisson&a=redisson-tomcat-9&v=3.10.7&e=jar)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册