Feature - RListMultimapCacheNative and RSetMultimapCacheNative objects added. Requires Redis 7.4+

pull/6120/head
Nikita Koksharov
parent 3f23018c83
commit a58958a851

@ -480,6 +480,22 @@ public final class Redisson implements RedissonClient {
commandExecutor.copy(params), params.getName());
}
@Override
public <K, V> RSetMultimapCacheNative<K, V> getSetMultimapCacheNative(String name) {
return new RedissonSetMultimapCacheNative<>(commandExecutor, name);
}
@Override
public <K, V> RSetMultimapCacheNative<K, V> getSetMultimapCacheNative(String name, Codec codec) {
return new RedissonSetMultimapCacheNative<>(codec, commandExecutor, name);
}
@Override
public <K, V> RSetMultimapCacheNative<K, V> getSetMultimapCacheNative(PlainOptions options) {
PlainParams params = (PlainParams) options;
return new RedissonSetMultimapCacheNative<>(params.getCodec(), commandExecutor.copy(params), params.getName());
}
@Override
public <K, V> RListMultimapCache<K, V> getListMultimapCache(String name) {
return new RedissonListMultimapCache<K, V>(evictionScheduler, commandExecutor, name);
@ -497,6 +513,23 @@ public final class Redisson implements RedissonClient {
commandExecutor.copy(params), params.getName());
}
@Override
public <K, V> RListMultimapCacheNative<K, V> getListMultimapCacheNative(String name) {
return new RedissonListMultimapCacheNative<K, V>(commandExecutor, name);
}
@Override
public <K, V> RListMultimapCacheNative<K, V> getListMultimapCacheNative(String name, Codec codec) {
return new RedissonListMultimapCacheNative<>(codec, commandExecutor, name);
}
@Override
public <K, V> RListMultimapCacheNative<K, V> getListMultimapCacheNative(PlainOptions options) {
PlainParams params = (PlainParams) options;
return new RedissonListMultimapCacheNative<>(params.getCodec(),
commandExecutor.copy(params), params.getName());
}
@Override
public <K, V> RSetMultimap<K, V> getSetMultimap(String name, Codec codec) {
return new RedissonSetMultimap<K, V>(codec, commandExecutor, name);

@ -0,0 +1,70 @@
/**
* Copyright (c) 2013-2024 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;
import org.redisson.api.RFuture;
import org.redisson.api.RListMultimapCacheNative;
import org.redisson.client.codec.Codec;
import org.redisson.command.CommandAsyncExecutor;
import java.util.concurrent.TimeUnit;
/**
* @author Nikita Koksharov
*
* @param <K> key
* @param <V> value
*/
public class RedissonListMultimapCacheNative<K, V> extends RedissonListMultimap<K, V> implements RListMultimapCacheNative<K, V> {
private final RedissonMultimapCacheNative<K> baseCache;
public RedissonListMultimapCacheNative(CommandAsyncExecutor connectionManager, String name) {
super(connectionManager, name);
baseCache = new RedissonMultimapCacheNative<>(connectionManager, this, prefix);
}
public RedissonListMultimapCacheNative(Codec codec, CommandAsyncExecutor connectionManager, String name) {
super(codec, connectionManager, name);
baseCache = new RedissonMultimapCacheNative<>(connectionManager, this, prefix);
}
@Override
public boolean expireKey(K key, long timeToLive, TimeUnit timeUnit) {
return get(expireKeyAsync(key, timeToLive, timeUnit));
}
@Override
public RFuture<Boolean> expireKeyAsync(K key, long timeToLive, TimeUnit timeUnit) {
return baseCache.expireKeyAsync(key, timeToLive, timeUnit);
}
@Override
public RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit, String param, String... keys) {
return baseCache.expireAsync(timeToLive, timeUnit, param);
}
@Override
protected RFuture<Boolean> expireAtAsync(long timestamp, String param, String... keys) {
return baseCache.expireAtAsync(timestamp, param);
}
@Override
public RFuture<Boolean> clearExpireAsync() {
return baseCache.clearExpireAsync();
}
}

@ -0,0 +1,117 @@
/**
* Copyright (c) 2013-2024 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;
import io.netty.buffer.ByteBuf;
import org.redisson.api.RFuture;
import org.redisson.api.RObject;
import org.redisson.client.codec.LongCodec;
import org.redisson.client.protocol.RedisCommands;
import org.redisson.command.CommandAsyncExecutor;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
/**
*
* @author Nikita Koksharov
*
* @param <K> key type
*/
class RedissonMultimapCacheNative<K> {
private final CommandAsyncExecutor commandExecutor;
private final RedissonMultimap<K, ?> object;
private final String prefix;
RedissonMultimapCacheNative(CommandAsyncExecutor commandExecutor, RObject object, String prefix) {
this.commandExecutor = commandExecutor;
this.object = (RedissonMultimap<K, ?>) object;
this.prefix = prefix;
}
public RFuture<Boolean> expireKeyAsync(K key, long timeToLive, TimeUnit timeUnit) {
ByteBuf keyState = object.encodeMapKey(key);
String keyHash = object.hash(keyState);
String setName = object.getValuesName(keyHash);
return commandExecutor.evalWriteAsync(object.getRawName(), object.getCodec(), RedisCommands.EVAL_BOOLEAN,
"if redis.call('hpexpire', KEYS[1], ARGV[1], 'fields', 1, ARGV[2]) == 1 then " +
"redis.call('pexpire', KEYS[2], ARGV[1]); " +
"return 1;" +
"end; "
+ "return 0; ",
Arrays.asList(object.getRawName(), setName),
timeUnit.toMillis(timeToLive), object.encodeMapKey(key));
}
public RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit, String param) {
return commandExecutor.evalWriteAsync(object.getRawName(), LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN,
"local entries = redis.call('hgetall', KEYS[1]); " +
"for i, v in ipairs(entries) do " +
"if i % 2 == 0 then " +
"local name = ARGV[2] .. v; "
+ "if ARGV[3] ~= '' then "
+ "redis.call('pexpire', name, ARGV[1], ARGV[3]); "
+ "else "
+ "redis.call('pexpire', name, ARGV[1]); "
+ "end; " +
"end;" +
"end; " +
"if ARGV[3] ~= '' then "
+ "return redis.call('pexpire', KEYS[1], ARGV[1], ARGV[3]); "
+ "end; " +
"return redis.call('pexpire', KEYS[1], ARGV[1]); ",
Arrays.asList(object.getRawName()),
timeUnit.toMillis(timeToLive), prefix, param);
}
public RFuture<Boolean> expireAtAsync(long timestamp, String param) {
return commandExecutor.evalWriteAsync(object.getRawName(), LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN,
"local entries = redis.call('hgetall', KEYS[1]); " +
"for i, v in ipairs(entries) do " +
"if i % 2 == 0 then " +
"local name = ARGV[2] .. v; "
+ "if ARGV[3] ~= '' then "
+ "redis.call('pexpireat', name, ARGV[1], ARGV[3]); "
+ "else "
+ "redis.call('pexpireat', name, ARGV[1]); "
+ "end; " +
"end;" +
"end; " +
"if ARGV[3] ~= '' then "
+ "return redis.call('pexpireat', KEYS[1], ARGV[1], ARGV[3]); "
+ "end; " +
"return redis.call('pexpireat', KEYS[1], ARGV[1]); ",
Arrays.asList(object.getRawName()),
timestamp, prefix, param);
}
public RFuture<Boolean> clearExpireAsync() {
return commandExecutor.evalWriteAsync(object.getRawName(), LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN,
"local entries = redis.call('hgetall', KEYS[1]); " +
"for i, v in ipairs(entries) do " +
"if i % 2 == 0 then " +
"local name = ARGV[1] .. v; " +
"redis.call('persist', name); " +
"end;" +
"end; " +
"return redis.call('persist', KEYS[1]); ",
Arrays.asList(object.getRawName()),
prefix);
}
}

@ -552,6 +552,29 @@ public class RedissonReactive implements RedissonReactiveClient {
new RedissonListMultimapCacheReactive<>(listMultimap, ca), RListMultimapCacheReactive.class);
}
@Override
public <K, V> RListMultimapCacheNativeReactive<K, V> getListMultimapCacheNative(String name) {
RedissonListMultimapCacheNative<K, V> listMultimap = new RedissonListMultimapCacheNative<>(commandExecutor, name);
return ReactiveProxyBuilder.create(commandExecutor, listMultimap,
new RedissonListMultimapCacheReactive<>(listMultimap, commandExecutor), RListMultimapCacheNativeReactive.class);
}
@Override
public <K, V> RListMultimapCacheNativeReactive<K, V> getListMultimapCacheNative(String name, Codec codec) {
RedissonListMultimapCacheNative<K, V> listMultimap = new RedissonListMultimapCacheNative<>(codec, commandExecutor, name);
return ReactiveProxyBuilder.create(commandExecutor, listMultimap,
new RedissonListMultimapCacheReactive<>(listMultimap, commandExecutor), RListMultimapCacheNativeReactive.class);
}
@Override
public <K, V> RListMultimapCacheNativeReactive<K, V> getListMultimapCacheNative(PlainOptions options) {
PlainParams params = (PlainParams) options;
CommandReactiveExecutor ca = commandExecutor.copy(params);
RedissonListMultimapCacheNative<K, V> listMultimap = new RedissonListMultimapCacheNative<>(params.getCodec(), ca, params.getName());
return ReactiveProxyBuilder.create(commandExecutor, listMultimap,
new RedissonListMultimapCacheReactive<>(listMultimap, ca), RListMultimapCacheNativeReactive.class);
}
@Override
public <K, V> RSetMultimapCacheReactive<K, V> getSetMultimapCache(String name) {
RedissonSetMultimapCache<K, V> setMultimap = new RedissonSetMultimapCache<>(evictionScheduler, commandExecutor, name);
@ -575,6 +598,29 @@ public class RedissonReactive implements RedissonReactiveClient {
new RedissonSetMultimapCacheReactive<K, V>(setMultimap, ca, this), RSetMultimapCacheReactive.class);
}
@Override
public <K, V> RSetMultimapCacheNativeReactive<K, V> getSetMultimapCacheNative(String name) {
RedissonSetMultimapCacheNative<K, V> setMultimap = new RedissonSetMultimapCacheNative<>(commandExecutor, name);
return ReactiveProxyBuilder.create(commandExecutor, setMultimap,
new RedissonSetMultimapCacheReactive<K, V>(setMultimap, commandExecutor, this), RSetMultimapCacheNativeReactive.class);
}
@Override
public <K, V> RSetMultimapCacheNativeReactive<K, V> getSetMultimapCacheNative(String name, Codec codec) {
RedissonSetMultimapCacheNative<K, V> setMultimap = new RedissonSetMultimapCacheNative<>(codec, commandExecutor, name);
return ReactiveProxyBuilder.create(commandExecutor, setMultimap,
new RedissonSetMultimapCacheReactive<K, V>(setMultimap, commandExecutor, this), RSetMultimapCacheNativeReactive.class);
}
@Override
public <K, V> RSetMultimapCacheNativeReactive<K, V> getSetMultimapCacheNative(PlainOptions options) {
PlainParams params = (PlainParams) options;
CommandReactiveExecutor ca = commandExecutor.copy(params);
RedissonSetMultimapCacheNative<K, V> setMultimap = new RedissonSetMultimapCacheNative<>(params.getCodec(), ca, params.getName());
return ReactiveProxyBuilder.create(commandExecutor, setMultimap,
new RedissonSetMultimapCacheReactive<K, V>(setMultimap, ca, this), RSetMultimapCacheNativeReactive.class);
}
@Override
public <K, V> RMapReactive<K, V> getMap(String name) {
RedissonMap<K, V> map = new RedissonMap<K, V>(commandExecutor, name, null, null, writeBehindService);

@ -471,6 +471,29 @@ public class RedissonRx implements RedissonRxClient {
new RedissonListMultimapCacheRx<K, V>(listMultimap, ce), RListMultimapCacheRx.class);
}
@Override
public <K, V> RListMultimapCacheNativeRx<K, V> getListMultimapCacheNative(String name) {
RedissonListMultimapCacheNative<K, V> listMultimap = new RedissonListMultimapCacheNative<>(commandExecutor, name);
return RxProxyBuilder.create(commandExecutor, listMultimap,
new RedissonListMultimapCacheRx<K, V>(listMultimap, commandExecutor), RListMultimapCacheNativeRx.class);
}
@Override
public <K, V> RListMultimapCacheNativeRx<K, V> getListMultimapCacheNative(String name, Codec codec) {
RedissonListMultimapCacheNative<K, V> listMultimap = new RedissonListMultimapCacheNative<>(codec, commandExecutor, name);
return RxProxyBuilder.create(commandExecutor, listMultimap,
new RedissonListMultimapCacheRx<K, V>(listMultimap, commandExecutor), RListMultimapCacheNativeRx.class);
}
@Override
public <K, V> RListMultimapCacheNativeRx<K, V> getListMultimapCacheNative(PlainOptions options) {
PlainParams params = (PlainParams) options;
CommandRxExecutor ce = commandExecutor.copy(params);
RedissonListMultimapCacheNative<K, V> listMultimap = new RedissonListMultimapCacheNative<>(params.getCodec(), ce, params.getName());
return RxProxyBuilder.create(commandExecutor, listMultimap,
new RedissonListMultimapCacheRx<K, V>(listMultimap, ce), RListMultimapCacheNativeRx.class);
}
@Override
public <K, V> RSetMultimapRx<K, V> getSetMultimap(String name) {
RedissonSetMultimap<K, V> setMultimap = new RedissonSetMultimap<>(commandExecutor, name);
@ -517,6 +540,29 @@ public class RedissonRx implements RedissonRxClient {
new RedissonSetMultimapCacheRx<>(setMultimap, ce, this), RSetMultimapCacheRx.class);
}
@Override
public <K, V> RSetMultimapCacheNativeRx<K, V> getSetMultimapCacheNative(String name) {
RedissonSetMultimapCacheNative<K, V> setMultimap = new RedissonSetMultimapCacheNative<>(commandExecutor, name);
return RxProxyBuilder.create(commandExecutor, setMultimap,
new RedissonSetMultimapCacheRx<>(setMultimap, commandExecutor, this), RSetMultimapCacheNativeRx.class);
}
@Override
public <K, V> RSetMultimapCacheNativeRx<K, V> getSetMultimapCacheNative(String name, Codec codec) {
RedissonSetMultimapCacheNative<K, V> setMultimap = new RedissonSetMultimapCacheNative<>(codec, commandExecutor, name);
return RxProxyBuilder.create(commandExecutor, setMultimap,
new RedissonSetMultimapCacheRx<>(setMultimap, commandExecutor, this), RSetMultimapCacheNativeRx.class);
}
@Override
public <K, V> RSetMultimapCacheNativeRx<K, V> getSetMultimapCacheNative(PlainOptions options) {
PlainParams params = (PlainParams) options;
CommandRxExecutor ce = commandExecutor.copy(params);
RedissonSetMultimapCacheNative<K, V> setMultimap = new RedissonSetMultimapCacheNative<>(params.getCodec(), ce, params.getName());
return RxProxyBuilder.create(commandExecutor, setMultimap,
new RedissonSetMultimapCacheRx<>(setMultimap, ce, this), RSetMultimapCacheNativeRx.class);
}
@Override
public <K, V> RMapRx<K, V> getMap(String name) {
RedissonMap<K, V> map = new RedissonMap<K, V>(commandExecutor, name, null, null, null);

@ -0,0 +1,70 @@
/**
* Copyright (c) 2013-2024 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;
import org.redisson.api.RFuture;
import org.redisson.api.RSetMultimapCacheNative;
import org.redisson.client.codec.Codec;
import org.redisson.command.CommandAsyncExecutor;
import java.util.concurrent.TimeUnit;
/**
* @author Nikita Koksharov
*
* @param <K> key
* @param <V> value
*/
public class RedissonSetMultimapCacheNative<K, V> extends RedissonSetMultimap<K, V> implements RSetMultimapCacheNative<K, V> {
private final RedissonMultimapCacheNative<K> baseCache;
public RedissonSetMultimapCacheNative(CommandAsyncExecutor connectionManager, String name) {
super(connectionManager, name);
baseCache = new RedissonMultimapCacheNative<>(connectionManager, this, prefix);
}
public RedissonSetMultimapCacheNative(Codec codec, CommandAsyncExecutor connectionManager, String name) {
super(codec, connectionManager, name);
baseCache = new RedissonMultimapCacheNative<>(connectionManager, this, prefix);
}
@Override
public boolean expireKey(K key, long timeToLive, TimeUnit timeUnit) {
return get(expireKeyAsync(key, timeToLive, timeUnit));
}
@Override
public RFuture<Boolean> expireKeyAsync(K key, long timeToLive, TimeUnit timeUnit) {
return baseCache.expireKeyAsync(key, timeToLive, timeUnit);
}
@Override
public RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit, String param, String... keys) {
return baseCache.expireAsync(timeToLive, timeUnit, param);
}
@Override
protected RFuture<Boolean> expireAtAsync(long timestamp, String param, String... keys) {
return baseCache.expireAtAsync(timestamp, param);
}
@Override
public RFuture<Boolean> clearExpireAsync() {
return baseCache.clearExpireAsync();
}
}

@ -0,0 +1,32 @@
/**
* Copyright (c) 2013-2024 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;
/**
* List based Multimap with ability to set TTL per entry.
* Stores insertion order and allows duplicates for values mapped to key.
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @author Nikita Koksharov
*
* @param <K> key
* @param <V> value
*/
public interface RListMultimapCacheNative<K, V> extends RListMultimap<K, V>, RMultimapCache<K, V> {
}

@ -0,0 +1,32 @@
/**
* Copyright (c) 2013-2024 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;
/**
* List based Multimap with ability to set TTL per entry.
* Stores insertion order and allows duplicates for values mapped to key.
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @author Nikita Koksharov
*
* @param <K> key
* @param <V> value
*/
public interface RListMultimapCacheNativeReactive<K, V> extends RListMultimapReactive<K, V>, RMultimapCacheReactive<K, V> {
}

@ -0,0 +1,32 @@
/**
* Copyright (c) 2013-2024 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;
/**
* List based Multimap with ability to set TTL per entry.
* Stores insertion order and allows duplicates for values mapped to key.
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @author Nikita Koksharov
*
* @param <K> key
* @param <V> value
*/
public interface RListMultimapCacheNativeRx<K, V> extends RListMultimapRx<K, V>, RMultimapCacheRx<K, V> {
}

@ -0,0 +1,32 @@
/**
* Copyright (c) 2013-2024 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;
/**
* Set based Multimap with ability to set TTL per entry.
* Doesn't allow duplications for values mapped to key.
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @author Nikita Koksharov
*
* @param <K> key
* @param <V> value
*/
public interface RSetMultimapCacheNative<K, V> extends RSetMultimap<K, V>, RMultimapCache<K, V> {
}

@ -0,0 +1,32 @@
/**
* Copyright (c) 2013-2024 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;
/**
* Set based Multimap with ability to set TTL per entry.
* Doesn't allow duplications for values mapped to key.
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @author Nikita Koksharov
*
* @param <K> key
* @param <V> value
*/
public interface RSetMultimapCacheNativeReactive<K, V> extends RSetMultimapReactive<K, V>, RMultimapCacheReactive<K, V> {
}

@ -0,0 +1,32 @@
/**
* Copyright (c) 2013-2024 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;
/**
* Set based Multimap with ability to set TTL per entry.
* Doesn't allow duplications for values mapped to key.
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @author Nikita Koksharov
*
* @param <K> key
* @param <V> value
*/
public interface RSetMultimapCacheNativeRx<K, V> extends RSetMultimapRx<K, V>, RMultimapCacheRx<K, V> {
}

@ -512,6 +512,56 @@ public interface RedissonClient {
*/
<K, V> RListMultimapCache<K, V> getListMultimapCache(PlainOptions options);
/**
* Returns List based Multimap instance by name.
* Supports key-entry eviction with a given TTL value.
* Stores insertion order and allows duplicates for values mapped to key.
* <p>
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @param <K> type of key
* @param <V> type of value
* @param name name of object
* @return ListMultimapCache object
*/
<K, V> RListMultimapCacheNative<K, V> getListMultimapCacheNative(String name);
/**
* Returns List based Multimap instance by name
* using provided codec for both map keys and values.
* Supports key-entry eviction with a given TTL value.
* Stores insertion order and allows duplicates for values mapped to key.
* <p>
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @param <K> type of key
* @param <V> type of value
* @param name name of object
* @param codec codec for keys and values
* @return ListMultimapCache object
*/
<K, V> RListMultimapCacheNative<K, V> getListMultimapCacheNative(String name, Codec codec);
/**
* Returns List based Multimap instance by name.
* Supports key-entry eviction with a given TTL value.
* Stores insertion order and allows duplicates for values mapped to key.
* <p>
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @param <K> type of key
* @param <V> type of value
* @param options instance options
* @return ListMultimapCache object
*/
<K, V> RListMultimapCacheNative<K, V> getListMultimapCacheNative(PlainOptions options);
/**
* Returns local cached map instance by name.
* Configured by parameters of options-object.
@ -722,6 +772,56 @@ public interface RedissonClient {
*/
<K, V> RSetMultimapCache<K, V> getSetMultimapCache(PlainOptions options);
/**
* Returns Set based Multimap instance by name.
* Supports key-entry eviction with a given TTL value.
* Doesn't allow duplications for values mapped to key.
* <p>
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @param <K> type of key
* @param <V> type of value
* @param name name of object
* @return SetMultimapCache object
*/
<K, V> RSetMultimapCacheNative<K, V> getSetMultimapCacheNative(String name);
/**
* Returns Set based Multimap instance by name
* using provided codec for both map keys and values.
* Supports key-entry eviction with a given TTL value.
* Doesn't allow duplications for values mapped to key.
* <p>
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @param <K> type of key
* @param <V> type of value
* @param name name of object
* @param codec codec for keys and values
* @return SetMultimapCache object
*/
<K, V> RSetMultimapCacheNative<K, V> getSetMultimapCacheNative(String name, Codec codec);
/**
* Returns Set based Multimap instance with specified <code>options</code>.
* Supports key-entry eviction with a given TTL value.
* Doesn't allow duplications for values mapped to key.
* <p>
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @param <K> type of key
* @param <V> type of value
* @param options instance options
* @return SetMultimapCache object
*/
<K, V> RSetMultimapCacheNative<K, V> getSetMultimapCacheNative(PlainOptions options);
/**
* Returns semaphore instance by name
*

@ -756,6 +756,56 @@ public interface RedissonReactiveClient {
*/
<K, V> RListMultimapCacheReactive<K, V> getListMultimapCache(PlainOptions options);
/**
* Returns List based Multimap instance by name.
* Supports key-entry eviction with a given TTL value.
* Stores insertion order and allows duplicates for values mapped to key.
* <p>
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @param <K> type of key
* @param <V> type of value
* @param name name of object
* @return ListMultimapCache object
*/
<K, V> RListMultimapCacheNativeReactive<K, V> getListMultimapCacheNative(String name);
/**
* Returns List based Multimap instance by name
* using provided codec for both map keys and values.
* Supports key-entry eviction with a given TTL value.
* Stores insertion order and allows duplicates for values mapped to key.
* <p>
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @param <K> type of key
* @param <V> type of value
* @param name name of object
* @param codec codec for keys and values
* @return ListMultimapCache object
*/
<K, V> RListMultimapCacheNativeReactive<K, V> getListMultimapCacheNative(String name, Codec codec);
/**
* Returns List based Multimap instance by name.
* Supports key-entry eviction with a given TTL value.
* Stores insertion order and allows duplicates for values mapped to key.
* <p>
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @param <K> type of key
* @param <V> type of value
* @param options instance options
* @return ListMultimapCache object
*/
<K, V> RListMultimapCacheNativeReactive<K, V> getListMultimapCacheNative(PlainOptions options);
/**
* Returns Set based Multimap instance by name.
*
@ -826,6 +876,56 @@ public interface RedissonReactiveClient {
*/
<K, V> RSetMultimapCacheReactive<K, V> getSetMultimapCache(PlainOptions options);
/**
* Returns Set based Multimap instance by name.
* Supports key-entry eviction with a given TTL value.
* Doesn't allow duplications for values mapped to key.
* <p>
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @param <K> type of key
* @param <V> type of value
* @param name name of object
* @return SetMultimapCache object
*/
<K, V> RSetMultimapCacheNativeReactive<K, V> getSetMultimapCacheNative(String name);
/**
* Returns Set based Multimap instance by name
* using provided codec for both map keys and values.
* Supports key-entry eviction with a given TTL value.
* Doesn't allow duplications for values mapped to key.
* <p>
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @param <K> type of key
* @param <V> type of value
* @param name name of object
* @param codec codec for keys and values
* @return SetMultimapCache object
*/
<K, V> RSetMultimapCacheNativeReactive<K, V> getSetMultimapCacheNative(String name, Codec codec);
/**
* Returns Set based Multimap instance with specified <code>options</code>.
* Supports key-entry eviction with a given TTL value.
* Doesn't allow duplications for values mapped to key.
* <p>
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @param <K> type of key
* @param <V> type of value
* @param options instance options
* @return SetMultimapCache object
*/
<K, V> RSetMultimapCacheNativeReactive<K, V> getSetMultimapCacheNative(PlainOptions options);
/**
* Returns map instance by name.
*

@ -745,6 +745,56 @@ public interface RedissonRxClient {
*/
<K, V> RListMultimapCacheRx<K, V> getListMultimapCache(PlainOptions options);
/**
* Returns List based Multimap instance by name.
* Supports key-entry eviction with a given TTL value.
* Stores insertion order and allows duplicates for values mapped to key.
* <p>
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @param <K> type of key
* @param <V> type of value
* @param name name of object
* @return ListMultimapCache object
*/
<K, V> RListMultimapCacheNativeRx<K, V> getListMultimapCacheNative(String name);
/**
* Returns List based Multimap instance by name
* using provided codec for both map keys and values.
* Supports key-entry eviction with a given TTL value.
* Stores insertion order and allows duplicates for values mapped to key.
* <p>
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @param <K> type of key
* @param <V> type of value
* @param name name of object
* @param codec codec for keys and values
* @return ListMultimapCache object
*/
<K, V> RListMultimapCacheNativeRx<K, V> getListMultimapCacheNative(String name, Codec codec);
/**
* Returns List based Multimap instance by name.
* Supports key-entry eviction with a given TTL value.
* Stores insertion order and allows duplicates for values mapped to key.
* <p>
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @param <K> type of key
* @param <V> type of value
* @param options instance options
* @return ListMultimapCache object
*/
<K, V> RListMultimapCacheNativeRx<K, V> getListMultimapCacheNative(PlainOptions options);
/**
* Returns Set based Multimap instance by name.
*
@ -815,6 +865,56 @@ public interface RedissonRxClient {
*/
<K, V> RSetMultimapCacheRx<K, V> getSetMultimapCache(PlainOptions options);
/**
* Returns Set based Multimap instance by name.
* Supports key-entry eviction with a given TTL value.
* Doesn't allow duplications for values mapped to key.
* <p>
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @param <K> type of key
* @param <V> type of value
* @param name name of object
* @return SetMultimapCache object
*/
<K, V> RSetMultimapCacheNativeRx<K, V> getSetMultimapCacheNative(String name);
/**
* Returns Set based Multimap instance by name
* using provided codec for both map keys and values.
* Supports key-entry eviction with a given TTL value.
* Doesn't allow duplications for values mapped to key.
* <p>
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @param <K> type of key
* @param <V> type of value
* @param name name of object
* @param codec codec for keys and values
* @return SetMultimapCache object
*/
<K, V> RSetMultimapCacheNativeRx<K, V> getSetMultimapCacheNative(String name, Codec codec);
/**
* Returns Set based Multimap instance with specified <code>options</code>.
* Supports key-entry eviction with a given TTL value.
* Doesn't allow duplications for values mapped to key.
* <p>
* Uses Redis native commands for entry expiration and not a scheduled eviction task.
* <p>
* Requires <b>Redis 7.4.0 and higher.</b>
*
* @param <K> type of key
* @param <V> type of value
* @param options instance options
* @return SetMultimapCache object
*/
<K, V> RSetMultimapCacheNativeRx<K, V> getSetMultimapCacheNative(PlainOptions options);
/**
* Returns map instance by name.
*

@ -16,7 +16,7 @@
package org.redisson.reactive;
import org.redisson.RedissonList;
import org.redisson.RedissonListMultimapCache;
import org.redisson.api.RListMultimap;
import org.redisson.api.RListReactive;
/**
@ -28,10 +28,10 @@ import org.redisson.api.RListReactive;
*/
public class RedissonListMultimapCacheReactive<K, V> {
private final RedissonListMultimapCache<K, V> instance;
private final RListMultimap<K, V> instance;
private final CommandReactiveExecutor commandExecutor;
public RedissonListMultimapCacheReactive(RedissonListMultimapCache<K, V> instance, CommandReactiveExecutor commandExecutor) {
public RedissonListMultimapCacheReactive(RListMultimap<K, V> instance, CommandReactiveExecutor commandExecutor) {
this.instance = instance;
this.commandExecutor = commandExecutor;
}

@ -16,7 +16,7 @@
package org.redisson.reactive;
import org.redisson.RedissonSet;
import org.redisson.RedissonSetMultimapCache;
import org.redisson.api.RSetMultimap;
import org.redisson.api.RSetReactive;
import org.redisson.api.RedissonReactiveClient;
@ -29,11 +29,11 @@ import org.redisson.api.RedissonReactiveClient;
*/
public class RedissonSetMultimapCacheReactive<K, V> {
private final RedissonSetMultimapCache<K, V> instance;
private final RSetMultimap<K, V> instance;
private final CommandReactiveExecutor commandExecutor;
private final RedissonReactiveClient redisson;
public RedissonSetMultimapCacheReactive(RedissonSetMultimapCache<K, V> instance, CommandReactiveExecutor commandExecutor,
public RedissonSetMultimapCacheReactive(RSetMultimap<K, V> instance, CommandReactiveExecutor commandExecutor,
RedissonReactiveClient redisson) {
this.instance = instance;
this.redisson = redisson;

@ -16,7 +16,7 @@
package org.redisson.rx;
import org.redisson.RedissonList;
import org.redisson.RedissonListMultimapCache;
import org.redisson.api.RListMultimap;
import org.redisson.api.RListRx;
/**
@ -28,10 +28,10 @@ import org.redisson.api.RListRx;
*/
public class RedissonListMultimapCacheRx<K, V> {
private final RedissonListMultimapCache<K, V> instance;
private final RListMultimap<K, V> instance;
private final CommandRxExecutor commandExecutor;
public RedissonListMultimapCacheRx(RedissonListMultimapCache<K, V> instance, CommandRxExecutor commandExecutor) {
public RedissonListMultimapCacheRx(RListMultimap<K, V> instance, CommandRxExecutor commandExecutor) {
this.instance = instance;
this.commandExecutor = commandExecutor;
}

@ -16,7 +16,7 @@
package org.redisson.rx;
import org.redisson.RedissonSet;
import org.redisson.RedissonSetMultimapCache;
import org.redisson.api.RSetMultimap;
import org.redisson.api.RSetRx;
import org.redisson.api.RedissonRxClient;
@ -29,11 +29,11 @@ import org.redisson.api.RedissonRxClient;
*/
public class RedissonSetMultimapCacheRx<K, V> {
private final RedissonSetMultimapCache<K, V> instance;
private final RSetMultimap<K, V> instance;
private final CommandRxExecutor commandExecutor;
private final RedissonRxClient redisson;
public RedissonSetMultimapCacheRx(RedissonSetMultimapCache<K, V> instance, CommandRxExecutor commandExecutor,
public RedissonSetMultimapCacheRx(RSetMultimap<K, V> instance, CommandRxExecutor commandExecutor,
RedissonRxClient redisson) {
this.instance = instance;
this.redisson = redisson;

Loading…
Cancel
Save