From 6e7076aa5d47367ec2264684542f7cf4f057b5df Mon Sep 17 00:00:00 2001 From: Nikita Koksharov Date: Fri, 8 Nov 2024 13:49:57 +0300 Subject: [PATCH] docs updated --- docs/data-and-services/collections.md | 47 +++++++++++++++++++- docs/data-and-services/data-serialization.md | 1 + 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/docs/data-and-services/collections.md b/docs/data-and-services/collections.md index e3748d7d9..767aea109 100644 --- a/docs/data-and-services/collections.md +++ b/docs/data-and-services/collections.md @@ -640,7 +640,8 @@ List oldValues = map.replaceValues(new SimpleKey("0"), newValues); List removedValues = map.removeAll(new SimpleKey("0")); ``` -### Multimap eviction + +### Eviction Multimap distributed object for Java with eviction support implemented by separated MultimapCache object. There are [RSetMultimapCache](https://static.javadoc.io/org.redisson/redisson/latest/org/redisson/api/RSetMultimapCache.html) and [RListMultimapCache](https://static.javadoc.io/org.redisson/redisson/latest/org/redisson/api/RListMultimapCache.html) objects for Set and List based Multimaps respectively. Eviction task is started once per unique object name at the moment of getting Multimap 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 or Valkey calls and eviction task per unique map object name. @@ -663,6 +664,50 @@ multimap.expireKey("2", 10, TimeUnit.MINUTES); multimap.destroy(); ``` +### Listeners + +Redisson allows binding listeners per `RSetMultimap` or `RListMultimap` object. This requires the `notify-keyspace-events` setting to be enabled on Redis or Valkey side. + +`RSetMultimap` listeners: + +|Listener class name|Event description | Valkey or Redis
`notify-keyspace-events` value| +|:--:|:--:|:--:| +|org.redisson.api.ExpiredObjectListener|`RSetMultimap` object expired| Ex| +|org.redisson.api.DeletedObjectListener|`RSetMultimap` object deleted| Eg| +|org.redisson.api.listener.SetAddListener|Element added to entry| Es| +|org.redisson.api.listener.SetRemoveListener|Element removed from entry| Es| +|org.redisson.api.listener.MapPutListener|Entry created|Eh| +|org.redisson.api.listener.MapRemoveListener|Entry removed|Eh| + +`RListMultimap` listeners: + +|Listener class name|Event description | Valkey or Redis
`notify-keyspace-events` value| +|:--:|:--:|:--:| +|org.redisson.api.ExpiredObjectListener|`RListMultimap` object expired| Ex| +|org.redisson.api.DeletedObjectListener|`RListMultimap` object deleted| Eg| +|org.redisson.api.listener.ListAddListener|Element added to entry| Es| +|org.redisson.api.listener.ListRemoveListener|Element removed from entry| Es| +|org.redisson.api.listener.MapPutListener|Entry created|Eh| +|org.redisson.api.listener.MapRemoveListener|Entry removed|Eh| + +Usage example: + +```java +RListMultimap lmap = redisson.getListMultimap("mymap"); + +int listenerId = lmap.addListener(new MapPutListener() { + @Override + public void onPut(String name) { + // ... + } +}); + +// ... + +lmap.removeListener(listenerId); +``` + + ## JSON Store _This feature is available only in [Redisson PRO](https://redisson.pro) edition._ diff --git a/docs/data-and-services/data-serialization.md b/docs/data-and-services/data-serialization.md index 87fbb3f54..0d56d3f93 100644 --- a/docs/data-and-services/data-serialization.md +++ b/docs/data-and-services/data-serialization.md @@ -14,6 +14,7 @@ Codec class name| Description `org.redisson.codec.MsgPackJacksonCodec`| [MsgPack](http://msgpack.org/) binary json codec `org.redisson.codec.IonJacksonCodec`| [Amazon Ion](https://amzn.github.io/ion-docs/) codec `org.redisson.codec.SerializationCodec`| JDK Serialization binary codec
(**Android** compatible) +`org.redisson.codec.ZStdCodec`| [ZStandard](https://github.com/luben/zstd-jni) compression codec.
Uses `Kryo5Codec` for serialization by default `org.redisson.codec.LZ4Codec`| [LZ4](https://github.com/jpountz/lz4-java) compression codec.
Uses `Kryo5Codec` for serialization by default `org.redisson.codec.LZ4CodecV2`| [LZ4 Apache Commons](https://github.com/apache/commons-compress) compression codec.
Uses `Kryo5Codec` for serialization by default `org.redisson.codec.SnappyCodecV2` | Snappy compression codec based on [snappy-java](https://github.com/xerial/snappy-java) project.
Uses `Kryo5Codec` for serialization by default