docs updated

pull/6262/head
Nikita Koksharov 3 months ago
parent b8e268b6d0
commit 0380ab23b7

@ -400,34 +400,7 @@ RLO objects can be cached in local cache on the Redisson side.
**local cache** - so called near cache used to speed up read operations and avoid network roundtrips. It caches JSON Store entries on Redisson side and executes read operations up to **45x faster** in comparison with regular implementation. Local cached instances with the same name are connected to the same pub/sub channel. This channel is used for exchanging of update/invalidate events between all instances. Local cache store doesn't use `hashCode()`/`equals()` methods of key object, instead it uses hash of serialized state.
To make an RLO entity stored in local cache it should be annotated with `@RCache` annotation.
`@RCache` annotation settings:
* `storeCacheMiss` - defines whether to store a cache miss into the local cache. Default value is `false`.
* `storeMode` - defines store mode of cache data. Default value is `LOCALCACHE_REDIS`. Follow options are available:
* `LOCALCACHE` - store data in local cache only and use Redis or Valkey only for data update/invalidation.
* `LOCALCACHE_REDIS` - store data in both Redis or Valkey and local cache.
* `cacheProvider` - defines Cache provider used as local cache store. Default value is `REDISSON`. Follow options are available:
* `REDISSON` - uses Redisson own implementation
* `CAFFEINE` - uses Caffeine implementation
* `evictionPolicy` - defines local cache eviction policy. Default value is `NONE`. Follow options are available:
* `LFU` - counts how often an item was requested. Those that are used least often are discarded first.
* `LRU` - discards the least recently used items first
* `SOFT` - uses soft references, entries are removed by GC
* `WEAK` - uses weak references, entries are removed by GC
* `NONE` - no eviction
* `cacheSize` - local cache size. If cache size is `0` then local cache is unbounded. If size is `-1` then local cache is always empty and doesn't store data. Default value is `0`.
* `reconnectionStrategy` - defines strategy for load missed local cache updates after connection failure. Default value is `NONE`. Follow options are available:
* `CLEAR` - clear local cache if map instance has been disconnected for a while.
* `NONE` - no reconnection handling
* `syncStrategy` - defines local cache synchronization strategy. Default value is `INVALIDATE`. Follow options are available:
* `INVALIDATE` - Default. Invalidate cache entry across all RLocalCachedJsonStore instances on map entry change
* `UPDATE` - Insert/update cache entry across all RLocalCachedJsonStore instances on map entry change
* `NONE` - No synchronizations on map changes
* `timeToLive` - defines time to live for each entry in local cache
* `maxIdle` - defines max idle time for each entry in local cache
* `useTopicPattern` - defines whether to use a global topic pattern listener that applies to all local cache instances belonging to the same Redisson instance. Default value is `true`.
To make an RLO entity stored in local cache it should be annotated with [@RCache](#annotations) annotation.
Usage example:
@ -472,25 +445,53 @@ Boolean registered = service.isClassRegistered(MyClass.class);
### Annotations
**@REntity**
**@REntity**
Applied to a class. The behaviour of each type of RLO can be customised through properties of the `@REntity` annotation. You can specify each of those properties to gain fine control over its behaviour:
* `namingScheme` - You can specify a naming scheme which tells Redisson how to assign key names for each instance of this class. It is used to create a reference to an existing Redisson Live Object and materialising a new one in redis. It defaults to use Redisson provided `DefaultNamingScheme`.
* `codec` - You can tell Redisson which `Codec` class you want to use for the RLO. Redisson will use an instance pool to locate the instance based on the class type. It defaults to `JsonJacksonCodec` provided by Redisson.
* `fieldTransformation` - You can also specify a field transformation mode for the RLO. As mentioned before, in order to keep everything as close to standard Java as possible, Redisson will automatically transform fields with commonly-used Java util classes to Redisson compatible classes. This uses `ANNOTATION_BASED` as the default value. You can set it to `IMPLEMENTATION_BASED` which will skip the transformation.
**@RId**
**@RCache**
Applied to a class. Allows to store in local cache each instance of the defined class. Annotation settings:
* `storeCacheMiss` - defines whether to store a cache miss into the local cache. Default value is `false`.
* `storeMode` - defines store mode of cache data. Default value is `LOCALCACHE_REDIS`. Follow options are available:
* `LOCALCACHE` - store data in local cache only and use Redis or Valkey only for data update/invalidation.
* `LOCALCACHE_REDIS` - store data in both Redis or Valkey and local cache.
* `cacheProvider` - defines Cache provider used as local cache store. Default value is `REDISSON`. Follow options are available:
* `REDISSON` - uses Redisson own implementation
* `CAFFEINE` - uses Caffeine implementation
* `evictionPolicy` - defines local cache eviction policy. Default value is `NONE`. Follow options are available:
* `LFU` - counts how often an item was requested. Those that are used least often are discarded first.
* `LRU` - discards the least recently used items first
* `SOFT` - uses soft references, entries are removed by GC
* `WEAK` - uses weak references, entries are removed by GC
* `NONE` - no eviction
* `cacheSize` - local cache size. If cache size is `0` then local cache is unbounded. If size is `-1` then local cache is always empty and doesn't store data. Default value is `0`.
* `reconnectionStrategy` - defines strategy for load missed local cache updates after connection failure. Default value is `NONE`. Follow options are available:
* `CLEAR` - clear local cache if map instance has been disconnected for a while.
* `NONE` - no reconnection handling
* `syncStrategy` - defines local cache synchronization strategy. Default value is `INVALIDATE`. Follow options are available:
* `INVALIDATE` - Default. Invalidate cache entry across all RLocalCachedJsonStore instances on map entry change
* `UPDATE` - Insert/update cache entry across all RLocalCachedJsonStore instances on map entry change
* `NONE` - No synchronizations on map changes
* `timeToLive` - defines time to live for each entry in local cache
* `maxIdle` - defines max idle time for each entry in local cache
* `useTopicPattern` - defines whether to use a global topic pattern listener that applies to all local cache instances belonging to the same Redisson instance. Default value is `true`.
**@RId**
Applied to a field. Defines `primary key` field of this class. The value of this field is used to create a reference to existing RLO. The field with this annotation is the only field that has its value also kept in the local VM. You can only have one `RId` annotation per class.
You can supply a `generator` strategy to the `@RId` annotation if you want the value of this field to be programatically generated. The default generator is `null`.
**@RIndex**
**@RIndex**
Applied to a field. Specifies that the field is used in search index. Allows to execute search query based on that field through `RLiveObjectService.find` method.
**@RObjectField**
**@RObjectField**
Applied to a field. Allows to specify `namingScheme` and/or `codec` different from what is specified in `@REntity`.
**@RCascade**
**@RCascade**
Applied to a field. Specifies that the defined cascade types are applied to the object/objects contained in Live Object field.
Different cascade types are available:

@ -17,9 +17,9 @@ Below is the libraries used by Redisson:
| com.fasterxml.jackson.dataformat | jackson-databind | 2.7+ | **required** |
| com.fasterxml.jackson.dataformat | jackson-annotations | 2.7+ | **required** |
| com.fasterxml.jackson.dataformat | jackson-dataformat-yaml | 2.7+ | **required** |
| org.yaml | snakeyaml | 1.0+ | **required** |
| org.yaml | snakeyaml | 2.0+ | **required** |
| net.bytebuddy | byte-buddy | 1.6+ | _optional (used by LiveObject service)_ |
| org.jodd | jodd-bean | 3.7+ | _optional (used by LiveObject service)_ |
| org.jodd | jodd-util | 6.0+ | _optional (used by LiveObject service)_ |
| javax.cache | cache-api | 1.1.1 | _optional (used by JCache implementation)_ |
| io.projectreactor | reactor-core | 3.1+ | _optional (used by RedissonReactiveClient)_ |
| io.reactivex.rxjava3 | rxjava | 3.0+ | _optional (used by RedissonRxClient)_ |

Loading…
Cancel
Save