diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bbc72c5f..f5cd5720b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,13 @@ Redisson Releases History Сonsider __[Redisson PRO](https://redisson.pro)__ version for advanced features and support by SLA. -### 13-Sep-2020 - 3.13.6 released +### Unreleased + +Feature - `RListMultimapCacheRx` and `RSetMultimapCacheRx` interfaces added, usable from `RedissonRx` and `RBatchRx` APIs + +Fixed - `RedissonSetMultimapRx` could throw a class cast exception on its `get()` method because it actually contained a list based multimap instance + +### 13-Oct-2020 - 3.13.6 released Improvement - set pingConnectionInterval = 30000 by default diff --git a/redisson/src/main/java/org/redisson/RedissonRx.java b/redisson/src/main/java/org/redisson/RedissonRx.java index f12ffdb2a..a1dc9c330 100644 --- a/redisson/src/main/java/org/redisson/RedissonRx.java +++ b/redisson/src/main/java/org/redisson/RedissonRx.java @@ -190,26 +190,58 @@ public class RedissonRx implements RedissonRxClient { @Override public RListMultimapRx getListMultimap(String name) { - return RxProxyBuilder.create(commandExecutor, new RedissonListMultimap(commandExecutor, name), - new RedissonListMultimapRx(commandExecutor, name), RListMultimapRx.class); + RedissonListMultimap listMultimap = new RedissonListMultimap<>(commandExecutor, name); + return RxProxyBuilder.create(commandExecutor, listMultimap, + new RedissonListMultimapRx(listMultimap, commandExecutor), RListMultimapRx.class); } @Override public RListMultimapRx getListMultimap(String name, Codec codec) { - return RxProxyBuilder.create(commandExecutor, new RedissonListMultimap(codec, commandExecutor, name), - new RedissonListMultimapRx(codec, commandExecutor, name), RListMultimapRx.class); + RedissonListMultimap listMultimap = new RedissonListMultimap<>(codec, commandExecutor, name); + return RxProxyBuilder.create(commandExecutor, listMultimap, + new RedissonListMultimapRx(listMultimap, commandExecutor), RListMultimapRx.class); + } + + @Override + public RListMultimapCacheRx getListMultimapCache(String name) { + RedissonListMultimapCache listMultimap = new RedissonListMultimapCache<>(evictionScheduler, commandExecutor, name); + return RxProxyBuilder.create(commandExecutor, listMultimap, + new RedissonListMultimapCacheRx(listMultimap, commandExecutor), RListMultimapCacheRx.class); + } + + @Override + public RListMultimapCacheRx getListMultimapCache(String name, Codec codec) { + RedissonListMultimapCache listMultimap = new RedissonListMultimapCache<>(evictionScheduler, codec, commandExecutor, name); + return RxProxyBuilder.create(commandExecutor, listMultimap, + new RedissonListMultimapCacheRx(listMultimap, commandExecutor), RListMultimapCacheRx.class); } @Override public RSetMultimapRx getSetMultimap(String name) { - return RxProxyBuilder.create(commandExecutor, new RedissonSetMultimap(commandExecutor, name), - new RedissonSetMultimapRx(commandExecutor, name, this), RSetMultimapRx.class); + RedissonSetMultimap setMultimap = new RedissonSetMultimap<>(commandExecutor, name); + return RxProxyBuilder.create(commandExecutor, setMultimap, + new RedissonSetMultimapRx(setMultimap, commandExecutor, this), RSetMultimapRx.class); } @Override public RSetMultimapRx getSetMultimap(String name, Codec codec) { - return RxProxyBuilder.create(commandExecutor, new RedissonSetMultimap(codec, commandExecutor, name), - new RedissonSetMultimapRx(codec, commandExecutor, name, this), RSetMultimapRx.class); + RedissonSetMultimap setMultimap = new RedissonSetMultimap<>(codec, commandExecutor, name); + return RxProxyBuilder.create(commandExecutor, setMultimap, + new RedissonSetMultimapRx(setMultimap, commandExecutor, this), RSetMultimapRx.class); + } + + @Override + public RSetMultimapCacheRx getSetMultimapCache(String name) { + RedissonSetMultimapCache setMultimap = new RedissonSetMultimapCache<>(evictionScheduler, commandExecutor, name); + return RxProxyBuilder.create(commandExecutor, setMultimap, + new RedissonSetMultimapCacheRx(setMultimap, commandExecutor, this), RSetMultimapCacheRx.class); + } + + @Override + public RSetMultimapCacheRx getSetMultimapCache(String name, Codec codec) { + RedissonSetMultimapCache setMultimap = new RedissonSetMultimapCache<>(evictionScheduler, codec, commandExecutor, name); + return RxProxyBuilder.create(commandExecutor, setMultimap, + new RedissonSetMultimapCacheRx(setMultimap, commandExecutor, this), RSetMultimapCacheRx.class); } @Override diff --git a/redisson/src/main/java/org/redisson/RedissonSetMultimapCache.java b/redisson/src/main/java/org/redisson/RedissonSetMultimapCache.java index 48cf24b81..c305c1a4f 100644 --- a/redisson/src/main/java/org/redisson/RedissonSetMultimapCache.java +++ b/redisson/src/main/java/org/redisson/RedissonSetMultimapCache.java @@ -39,7 +39,7 @@ public class RedissonSetMultimapCache extends RedissonSetMultimap im private final RedissonMultimapCache baseCache; - RedissonSetMultimapCache(EvictionScheduler evictionScheduler, CommandAsyncExecutor connectionManager, String name) { + public RedissonSetMultimapCache(EvictionScheduler evictionScheduler, CommandAsyncExecutor connectionManager, String name) { super(connectionManager, name); if (evictionScheduler != null) { evictionScheduler.scheduleCleanMultimap(name, getTimeoutSetName()); @@ -47,7 +47,7 @@ public class RedissonSetMultimapCache extends RedissonSetMultimap im baseCache = new RedissonMultimapCache(connectionManager, this, getTimeoutSetName(), prefix); } - RedissonSetMultimapCache(EvictionScheduler evictionScheduler, Codec codec, CommandAsyncExecutor connectionManager, String name) { + public RedissonSetMultimapCache(EvictionScheduler evictionScheduler, Codec codec, CommandAsyncExecutor connectionManager, String name) { super(codec, connectionManager, name); if (evictionScheduler != null) { evictionScheduler.scheduleCleanMultimap(name, getTimeoutSetName()); diff --git a/redisson/src/main/java/org/redisson/api/RBatchRx.java b/redisson/src/main/java/org/redisson/api/RBatchRx.java index 9ee08fb23..ef7aa60a6 100644 --- a/redisson/src/main/java/org/redisson/api/RBatchRx.java +++ b/redisson/src/main/java/org/redisson/api/RBatchRx.java @@ -98,7 +98,32 @@ public interface RBatchRx { * @return SetMultimap object */ RSetMultimapRx getSetMultimap(String name, Codec codec); - + + /** + * Returns Set based Multimap cache instance by name. + * Supports key eviction by specifying a time to live. + * If eviction is not required then it's better to use regular set multimap {@link #getSetMultimap(String)}. + * + * @param type of key + * @param type of value + * @param name - name of object + * @return RSetMultimapCacheRx object + */ + RSetMultimapCacheRx getSetMultimapCache(String name); + + /** + * Returns Set based Multimap cache instance by name using provided codec for both map keys and values. + * Supports key eviction by specifying a time to live. + * If eviction is not required then it's better to use regular set multimap {@link #getSetMultimap(String, Codec)}. + * + * @param type of key + * @param type of value + * @param name - name of object + * @param codec - codec for keys and values + * @return RSetMultimapCacheRx object + */ + RSetMultimapCacheRx getSetMultimapCache(String name, Codec codec); + /** * Returns set-based cache instance by name. * Uses map (value_hash, value) under the hood for minimal memory consumption. @@ -209,7 +234,33 @@ public interface RBatchRx { * @return ListMultimap object */ RListMultimapRx getListMultimap(String name, Codec codec); - + + + /** + * Returns List based Multimap cache instance by name. + * Supports key eviction by specifying a time to live. + * If eviction is not required then it's better to use regular list multimap {@link #getListMultimap(String)}. + * + * @param type of key + * @param type of value + * @param name - name of object + * @return RListMultimapCacheRx object + */ + RListMultimapCacheRx getListMultimapCache(String name); + + /** + * Returns List based Multimap cache instance by name using provided codec for both map keys and values. + * Supports key eviction by specifying a time to live. + * If eviction is not required then it's better to use regular list multimap {@link #getListMultimap(String, Codec)}. + * + * @param type of key + * @param type of value + * @param name - name of object + * @param codec - codec for keys and values + * @return RListMultimapCacheRx object + */ + RListMultimapCacheRx getListMultimapCache(String name, Codec codec); + /** * Returns map instance by name. * diff --git a/redisson/src/main/java/org/redisson/api/RListMultimapCacheRx.java b/redisson/src/main/java/org/redisson/api/RListMultimapCacheRx.java new file mode 100644 index 000000000..aebd7ab44 --- /dev/null +++ b/redisson/src/main/java/org/redisson/api/RListMultimapCacheRx.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2013-2020 Nikita Koksharov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.redisson.api; + +/** + * Rx-ified version of {@link RListMultimapCache}. + * + * @author Marnix Kammer + * + * @param key type + * @param value type + */ +public interface RListMultimapCacheRx extends RListMultimapRx, RMultimapCacheRx { + +} diff --git a/redisson/src/main/java/org/redisson/api/RMultimapCacheRx.java b/redisson/src/main/java/org/redisson/api/RMultimapCacheRx.java new file mode 100644 index 000000000..9acaf9e1a --- /dev/null +++ b/redisson/src/main/java/org/redisson/api/RMultimapCacheRx.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2013-2020 Nikita Koksharov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.redisson.api; + +import io.reactivex.Single; + +import java.util.concurrent.TimeUnit; + +/** + * Rx-ified version of {@link RMultimapCache}. + * + * @author Marnix Kammer + * + * @param key type + * @param value type + */ +public interface RMultimapCacheRx { + + /** + * Set a timeout for key. After the timeout has expired, the key and its values will automatically be deleted. + * + * @param key - map key + * @param timeToLive - timeout before key will be deleted + * @param timeUnit - timeout time unit + * @return A Single that will emit true if key exists and the timeout was set and false + * if key not exists + */ + Single expireKey(K key, long timeToLive, TimeUnit timeUnit); +} diff --git a/redisson/src/main/java/org/redisson/api/RSetMultimapCacheRx.java b/redisson/src/main/java/org/redisson/api/RSetMultimapCacheRx.java new file mode 100644 index 000000000..fe8b9983d --- /dev/null +++ b/redisson/src/main/java/org/redisson/api/RSetMultimapCacheRx.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2013-2020 Nikita Koksharov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.redisson.api; + +/** + * Rx-ified version of {@link RSetMultimapCache}. + * + * @author Marnix Kammer + * + * @param key type + * @param value type + */ +public interface RSetMultimapCacheRx extends RSetMultimapRx, RMultimapCacheRx { + +} diff --git a/redisson/src/main/java/org/redisson/api/RedissonRxClient.java b/redisson/src/main/java/org/redisson/api/RedissonRxClient.java index 27b8aa950..eb66643c3 100644 --- a/redisson/src/main/java/org/redisson/api/RedissonRxClient.java +++ b/redisson/src/main/java/org/redisson/api/RedissonRxClient.java @@ -367,6 +367,31 @@ public interface RedissonRxClient { */ RListMultimapRx getListMultimap(String name, Codec codec); + /** + * Returns List based Multimap cache instance by name. + * Supports key eviction by specifying a time to live. + * If eviction is not required then it's better to use regular list multimap {@link #getListMultimap(String)}. + * + * @param type of key + * @param type of value + * @param name - name of object + * @return RListMultimapCacheRx object + */ + RListMultimapCacheRx getListMultimapCache(String name); + + /** + * Returns List based Multimap cache instance by name using provided codec for both map keys and values. + * Supports key eviction by specifying a time to live. + * If eviction is not required then it's better to use regular list multimap {@link #getListMultimap(String, Codec)}. + * + * @param type of key + * @param type of value + * @param name - name of object + * @param codec - codec for keys and values + * @return RListMultimapCacheRx object + */ + RListMultimapCacheRx getListMultimapCache(String name, Codec codec); + /** * Returns Set based Multimap instance by name. * @@ -388,7 +413,32 @@ public interface RedissonRxClient { * @return SetMultimap object */ RSetMultimapRx getSetMultimap(String name, Codec codec); - + + /** + * Returns Set based Multimap cache instance by name. + * Supports key eviction by specifying a time to live. + * If eviction is not required then it's better to use regular set multimap {@link #getSetMultimap(String)}. + * + * @param type of key + * @param type of value + * @param name - name of object + * @return RSetMultimapCacheRx object + */ + RSetMultimapCacheRx getSetMultimapCache(String name); + + /** + * Returns Set based Multimap cache instance by name using provided codec for both map keys and values. + * Supports key eviction by specifying a time to live. + * If eviction is not required then it's better to use regular set multimap {@link #getSetMultimap(String, Codec)}. + * + * @param type of key + * @param type of value + * @param name - name of object + * @param codec - codec for keys and values + * @return RSetMultimapCacheRx object + */ + RSetMultimapCacheRx getSetMultimapCache(String name, Codec codec); + /** * Returns map instance by name. * diff --git a/redisson/src/main/java/org/redisson/rx/RedissonBatchRx.java b/redisson/src/main/java/org/redisson/rx/RedissonBatchRx.java index 0fb515f15..ebb8404d7 100644 --- a/redisson/src/main/java/org/redisson/rx/RedissonBatchRx.java +++ b/redisson/src/main/java/org/redisson/rx/RedissonBatchRx.java @@ -263,26 +263,58 @@ public class RedissonBatchRx implements RBatchRx { @Override public RSetMultimapRx getSetMultimap(String name) { - return RxProxyBuilder.create(executorService, new RedissonSetMultimap(executorService, name), - new RedissonSetMultimapRx(executorService, name, null), RSetMultimapRx.class); + RedissonSetMultimap setMultimap = new RedissonSetMultimap<>(executorService, name); + return RxProxyBuilder.create(executorService, setMultimap, + new RedissonSetMultimapRx(setMultimap, executorService, null), RSetMultimapRx.class); } @Override public RSetMultimapRx getSetMultimap(String name, Codec codec) { - return RxProxyBuilder.create(executorService, new RedissonSetMultimap(codec, executorService, name), - new RedissonSetMultimapRx(codec, executorService, name, null), RSetMultimapRx.class); + RedissonSetMultimap setMultimap = new RedissonSetMultimap<>(codec, executorService, name); + return RxProxyBuilder.create(executorService, setMultimap, + new RedissonSetMultimapRx(setMultimap, executorService, null), RSetMultimapRx.class); + } + + @Override + public RSetMultimapCacheRx getSetMultimapCache(String name) { + RedissonSetMultimapCache setMultimap = new RedissonSetMultimapCache<>(evictionScheduler, executorService, name); + return RxProxyBuilder.create(executorService, setMultimap, + new RedissonSetMultimapCacheRx(setMultimap, executorService, null), RSetMultimapCacheRx.class); + } + + @Override + public RSetMultimapCacheRx getSetMultimapCache(String name, Codec codec) { + RedissonSetMultimapCache setMultimap = new RedissonSetMultimapCache<>(evictionScheduler, codec, executorService, name); + return RxProxyBuilder.create(executorService, setMultimap, + new RedissonSetMultimapCacheRx(setMultimap, executorService, null), RSetMultimapCacheRx.class); } @Override public RListMultimapRx getListMultimap(String name) { - return RxProxyBuilder.create(executorService, new RedissonListMultimap(executorService, name), - new RedissonListMultimapRx(executorService, name), RListMultimapRx.class); + RedissonListMultimap listMultimap = new RedissonListMultimap<>(executorService, name); + return RxProxyBuilder.create(executorService, listMultimap, + new RedissonListMultimapRx(listMultimap, executorService), RListMultimapRx.class); } @Override public RListMultimapRx getListMultimap(String name, Codec codec) { - return RxProxyBuilder.create(executorService, new RedissonListMultimap(codec, executorService, name), - new RedissonListMultimapRx(codec, executorService, name), RListMultimapRx.class); + RedissonListMultimap listMultimap = new RedissonListMultimap<>(codec, executorService, name); + return RxProxyBuilder.create(executorService, listMultimap, + new RedissonListMultimapRx(listMultimap, executorService), RListMultimapRx.class); + } + + @Override + public RListMultimapCacheRx getListMultimapCache(String name) { + RedissonListMultimapCache listMultimap = new RedissonListMultimapCache<>(evictionScheduler, executorService, name); + return RxProxyBuilder.create(executorService, listMultimap, + new RedissonListMultimapCacheRx(listMultimap, executorService), RListMultimapCacheRx.class); + } + + @Override + public RListMultimapCacheRx getListMultimapCache(String name, Codec codec) { + RedissonListMultimapCache listMultimap = new RedissonListMultimapCache<>(evictionScheduler, codec, executorService, name); + return RxProxyBuilder.create(executorService, listMultimap, + new RedissonListMultimapCacheRx(listMultimap, executorService), RListMultimapCacheRx.class); } @Override diff --git a/redisson/src/main/java/org/redisson/rx/RedissonListMultimapCacheRx.java b/redisson/src/main/java/org/redisson/rx/RedissonListMultimapCacheRx.java new file mode 100644 index 000000000..65020b1cb --- /dev/null +++ b/redisson/src/main/java/org/redisson/rx/RedissonListMultimapCacheRx.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2013-2020 Nikita Koksharov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.redisson.rx; + +import org.redisson.RedissonList; +import org.redisson.RedissonListMultimapCache; +import org.redisson.api.RListRx; + +/** + * + * @author Marnix Kammer + * + * @param key type + * @param value type + */ +public class RedissonListMultimapCacheRx { + + private final RedissonListMultimapCache instance; + private final CommandRxExecutor commandExecutor; + + public RedissonListMultimapCacheRx(RedissonListMultimapCache instance, CommandRxExecutor commandExecutor) { + this.instance = instance; + this.commandExecutor = commandExecutor; + } + + public RListRx get(K key) { + RedissonList list = (RedissonList) instance.get(key); + return RxProxyBuilder.create(commandExecutor, list, new RedissonListRx<>(list), RListRx.class); + } +} diff --git a/redisson/src/main/java/org/redisson/rx/RedissonListMultimapRx.java b/redisson/src/main/java/org/redisson/rx/RedissonListMultimapRx.java index 91213df09..a8cf9ac23 100644 --- a/redisson/src/main/java/org/redisson/rx/RedissonListMultimapRx.java +++ b/redisson/src/main/java/org/redisson/rx/RedissonListMultimapRx.java @@ -17,9 +17,7 @@ package org.redisson.rx; import org.redisson.RedissonList; import org.redisson.RedissonListMultimap; -import org.redisson.api.RListMultimap; import org.redisson.api.RListRx; -import org.redisson.client.codec.Codec; /** * @@ -33,18 +31,13 @@ public class RedissonListMultimapRx { private final CommandRxExecutor commandExecutor; private final RedissonListMultimap instance; - public RedissonListMultimapRx(CommandRxExecutor commandExecutor, String name) { - this.instance = new RedissonListMultimap(commandExecutor, name); - this.commandExecutor = commandExecutor; - } - - public RedissonListMultimapRx(Codec codec, CommandRxExecutor commandExecutor, String name) { - this.instance = new RedissonListMultimap(codec, commandExecutor, name); + public RedissonListMultimapRx(RedissonListMultimap instance, CommandRxExecutor commandExecutor) { + this.instance = instance; this.commandExecutor = commandExecutor; } public RListRx get(K key) { - RedissonList list = (RedissonList) ((RListMultimap) instance).get(key); + RedissonList list = (RedissonList) instance.get(key); return RxProxyBuilder.create(commandExecutor, instance, new RedissonListRx(list), RListRx.class); } diff --git a/redisson/src/main/java/org/redisson/rx/RedissonSetMultimapCacheRx.java b/redisson/src/main/java/org/redisson/rx/RedissonSetMultimapCacheRx.java new file mode 100644 index 000000000..6ad32be39 --- /dev/null +++ b/redisson/src/main/java/org/redisson/rx/RedissonSetMultimapCacheRx.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2013-2020 Nikita Koksharov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.redisson.rx; + +import org.redisson.RedissonSet; +import org.redisson.RedissonSetMultimapCache; +import org.redisson.api.RSetRx; +import org.redisson.api.RedissonRxClient; + +/** + * + * @author Marnix Kammer + * + * @param key type + * @param value type + */ +public class RedissonSetMultimapCacheRx { + + private final RedissonSetMultimapCache instance; + private final CommandRxExecutor commandExecutor; + private final RedissonRxClient redisson; + + public RedissonSetMultimapCacheRx(RedissonSetMultimapCache instance, CommandRxExecutor commandExecutor, + RedissonRxClient redisson) { + this.instance = instance; + this.redisson = redisson; + this.commandExecutor = commandExecutor; + } + + public RSetRx get(K key) { + RedissonSet set = (RedissonSet) instance.get(key); + return RxProxyBuilder.create(commandExecutor, set, new RedissonSetRx<>(set, redisson), RSetRx.class); + } +} diff --git a/redisson/src/main/java/org/redisson/rx/RedissonSetMultimapRx.java b/redisson/src/main/java/org/redisson/rx/RedissonSetMultimapRx.java index c589d91fc..4bac762a5 100644 --- a/redisson/src/main/java/org/redisson/rx/RedissonSetMultimapRx.java +++ b/redisson/src/main/java/org/redisson/rx/RedissonSetMultimapRx.java @@ -15,12 +15,10 @@ */ package org.redisson.rx; -import org.redisson.RedissonListMultimap; import org.redisson.RedissonSet; -import org.redisson.api.RSetMultimap; +import org.redisson.RedissonSetMultimap; import org.redisson.api.RSetRx; import org.redisson.api.RedissonRxClient; -import org.redisson.client.codec.Codec; /** * @@ -33,22 +31,16 @@ public class RedissonSetMultimapRx { private final RedissonRxClient redisson; private final CommandRxExecutor commandExecutor; - private final RedissonListMultimap instance; + private final RedissonSetMultimap instance; - public RedissonSetMultimapRx(CommandRxExecutor commandExecutor, String name, RedissonRxClient redisson) { - this.instance = new RedissonListMultimap(commandExecutor, name); - this.redisson = redisson; - this.commandExecutor = commandExecutor; - } - - public RedissonSetMultimapRx(Codec codec, CommandRxExecutor commandExecutor, String name, RedissonRxClient redisson) { - this.instance = new RedissonListMultimap(codec, commandExecutor, name); + public RedissonSetMultimapRx(RedissonSetMultimap instance, CommandRxExecutor commandExecutor, RedissonRxClient redisson) { + this.instance = instance; this.redisson = redisson; this.commandExecutor = commandExecutor; } public RSetRx get(K key) { - RedissonSet set = (RedissonSet) ((RSetMultimap) instance).get(key); + RedissonSet set = (RedissonSet) instance.get(key); return RxProxyBuilder.create(commandExecutor, set, new RedissonSetRx(set, redisson), RSetRx.class); }