diff --git a/redisson/src/main/java/org/redisson/jcache/JCache.java b/redisson/src/main/java/org/redisson/jcache/JCache.java index fb84f4202..2546c3ee0 100644 --- a/redisson/src/main/java/org/redisson/jcache/JCache.java +++ b/redisson/src/main/java/org/redisson/jcache/JCache.java @@ -1302,10 +1302,10 @@ public class JCache extends RedissonObject implements Cache, CacheAs List params = new ArrayList<>(keys.length + 1); params.add(System.currentTimeMillis()); encodeMapKeys(params, Arrays.asList(keys)); - return removeValuesOperation(commandExecutor, getRawName(), null, params); + return removeValuesOperation(commandExecutor, getRawName(), null, params, null); } - RFuture removeValuesOperation(CommandAsyncExecutor commandExecutor, String name, MasterSlaveEntry entry, List params) { + RFuture removeValuesOperation(CommandAsyncExecutor commandExecutor, String name, MasterSlaveEntry entry, List params, Object[] keys) { String script = "local counter = 0;" + "for i=2, #ARGV do " + "local value = redis.call('hget', KEYS[1], ARGV[i]); " @@ -2999,8 +2999,15 @@ public class JCache extends RedissonObject implements Cache, CacheAs @Override public RFuture clearAsync() { + return clearAsync(commandExecutor, null, getRawName()); + } + + RFuture clearAsync(CommandAsyncExecutor commandExecutor, MasterSlaveEntry entry, String name) { checkNotClosed(); - return commandExecutor.writeAsync(getRawName(), RedisCommands.DEL_OBJECTS, getRawName(), getTimeoutSetName()); + if (entry == null) { + return commandExecutor.writeAsync(name, StringCodec.INSTANCE, RedisCommands.DEL_VOID, name, getTimeoutSetName(name)); + } + return commandExecutor.writeAsync(entry, StringCodec.INSTANCE, RedisCommands.DEL_VOID, name, getTimeoutSetName(name)); } @Override