From 4947a670410d95fe12da2d88fb5eb99f1ee0896b Mon Sep 17 00:00:00 2001 From: Nikita Koksharov Date: Fri, 23 Aug 2024 08:58:59 +0300 Subject: [PATCH] Update README.md --- redisson-hibernate/README.md | 61 +++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/redisson-hibernate/README.md b/redisson-hibernate/README.md index aa14f3735..5817ccea7 100644 --- a/redisson-hibernate/README.md +++ b/redisson-hibernate/README.md @@ -11,27 +11,46 @@ Redisson provides various Hibernate Cache factories including those with feature **data partitioning** - although all implementations are cluster compatible thier content isn't scaled/partitioned across multiple Redis master nodes in cluster. Data partitioning allows to scale available memory, read/write operations and entry eviction process for individual Hibernate Cache instance in Redis cluster. -**`scripted` entry eviction** - allows to define `time to live` or `max idle time` parameters per map entry. Redis hash structure doesn't support eviction thus it's done on Redisson side through a custom scheduled task which removes expired entries using Lua script. Eviction task is started upon first Cache access moment and unique per cache name. This leads to extra Redis calls and eviction task per unique map object name. - -**`advanced` entry eviction** - allows to define `time to live` parameter per map entry. Doesn't use an entry eviction task. - -**`native` entry eviction** - allows to define `time to live` parameter per map entry. Doesn't use an entry eviction task. Requires **Redis 7.4+**. - -Below is the list of all available factories with local cache and/or data partitioning support: - -|Class name | Local cache | Data
partitioning | Entry
eviction | Ultra-fast
read/write | -| ------------- | :-----------: | :----------:| :----------:| :----------:| -|RedissonRegionFactory
open-source version | ❌ | ❌ | **scripted** | ❌ | -|RedissonRegionNativeFactory
open-source version | ❌ | ❌ | **native** | ❌ | -|RedissonRegionFactory
[Redisson PRO](http://redisson.pro) version | ❌ | ❌ | **scripted** | ✔️ | -|RedissonRegionNativeFactory
[Redisson PRO](http://redisson.pro) version | ❌ | ❌ | **native** | ✔️ | -|RedissonRegionV2Factory
available only in [Redisson PRO](http://redisson.pro) | ❌ | ✔️ | **advanced** | ✔️ | -|RedissonLocalCachedRegionFactory
available only in [Redisson PRO](http://redisson.pro) | ✔️ | ❌ | **scripted** | ✔️ | -|RedissonLocalCachedV2RegionFactory
available only in [Redisson PRO](http://redisson.pro) | ✔️ | ✔️ | **advanced** | ✔️ | -|RedissonLocalCachedNativeRegionFactory
available only in [Redisson PRO](http://redisson.pro) | ✔️ | ✔️ | **native** | ✔️ | -|RedissonClusteredRegionFactory
available only in [Redisson PRO](http://redisson.pro) | ❌ | ✔️ | **scripted** | ✔️ | -|RedissonClusteredNativeRegionFactory
available only in [Redisson PRO](http://redisson.pro) | ❌ | ✔️ | **native** | ✔️ | -|RedissonClusteredLocalCachedRegionFactory
available only in [Redisson PRO](http://redisson.pro) | ✔️ | ✔️ | **scripted** | ✔️ | +#### 1. Scripted eviction + +Allows to define `time to live` or `max idle time` parameters per map entry. Redis hash structure doesn't support eviction thus it's done on Redisson side through a custom scheduled task which removes expired entries using Lua script. Eviction task is started once per unique object name at the moment of getting Map instance. If instance isn't used and has expired entries it should be get again to start the eviction process. This leads to extra Redis calls and eviction task per unique map object name. + +Entries are cleaned time to time by `org.redisson.eviction.EvictionScheduler`. By default, it removes 100 expired entries at a time. This can be changed through [cleanUpKeysAmount](https://github.com/redisson/redisson/wiki/2.-Configuration#cleanupkeysamount) setting. Task launch time tuned automatically and depends on expired entries amount deleted in previous time and varies between 5 second to 30 minutes by default. This time interval can be changed through [minCleanUpDelay](https://github.com/redisson/redisson/wiki/2.-Configuration#mincleanupdelay) and [maxCleanUpDelay](https://github.com/redisson/redisson/wiki/2.-Configuration#maxcleanupdelay). For example, if clean task deletes 100 entries each time it will be executed every 5 seconds (minimum execution delay). But if current expired entries amount is lower than previous one then execution delay will be increased by 1.5 times and decreased otherwise. + +Available implementations: + +|Class name | Local cache | Data
partitioning | Ultra-fast
read/write | +| ------------- | :-----------: | :----------:| :----------:| +|RedissonRegionFactory
open-source version | ❌ | ❌ | ❌ | +|RedissonRegionFactory
[Redisson PRO](http://redisson.pro) version | ❌ | ❌ | ✔️ | +|RedissonLocalCachedRegionFactory
available only in [Redisson PRO](http://redisson.pro) | ✔️ | ❌ | ✔️ | +|RedissonClusteredRegionFactory
available only in [Redisson PRO](http://redisson.pro) | ❌ | ✔️ | ✔️ | +|RedissonClusteredLocalCachedRegionFactory
available only in [Redisson PRO](http://redisson.pro) | ✔️ | ✔️ | ✔️ | + +#### 2. Advanced eviction + +Allows to define `time to live` parameter per map entry. Doesn't use an entry eviction task, entries are cleaned on Redis side. + +Available implementations: + +|Class name | Local cache | Data
partitioning | Ultra-fast
read/write | +| ------------- | :-----------: | :----------:| :----------:| +|RedissonRegionV2Factory
available only in [Redisson PRO](http://redisson.pro) | ❌ | ✔️ | ✔️ | +|RedissonLocalCachedV2RegionFactory
available only in [Redisson PRO](http://redisson.pro) | ✔️ | ✔️ | ✔️ | + +#### 3. Native eviction + +Allows to define `time to live` parameter per map entry. Doesn't use an entry eviction task, entries are cleaned on Redis side. +Requires **Redis 7.4+**. + +Available implementations: + +|Class name | Local cache | Data
partitioning | Ultra-fast
read/write | +| ------------- | :-----------: | :----------:| :----------:| +|RedissonRegionNativeFactory
open-source version | ❌ | ❌ | ❌ | +|RedissonRegionNativeFactory
[Redisson PRO](http://redisson.pro) version | ❌ | ❌ | ✔️ | +|RedissonLocalCachedNativeRegionFactory
available only in [Redisson PRO](http://redisson.pro) | ✔️ | ✔️ | ✔️ | +|RedissonClusteredNativeRegionFactory
available only in [Redisson PRO](http://redisson.pro) | ❌ | ✔️ | ✔️ | ## Hibernate Cache Usage