diff --git a/redisson/src/main/java/org/redisson/RedissonLocalCachedMap.java b/redisson/src/main/java/org/redisson/RedissonLocalCachedMap.java index 722fdbc60..884aea748 100644 --- a/redisson/src/main/java/org/redisson/RedissonLocalCachedMap.java +++ b/redisson/src/main/java/org/redisson/RedissonLocalCachedMap.java @@ -727,16 +727,16 @@ public class RedissonLocalCachedMap extends RedissonMap implements R params.add(map.size()*2); byte[][] hashes = new byte[map.size()][]; int i = 0; - Map clonedMap = new HashMap<>(); + for (java.util.Map.Entry t : map.entrySet()) { ByteBuf mapKey = encodeMapKey(t.getKey()); ByteBuf mapValue = encodeMapValue(t.getValue()); params.add(mapKey); params.add(mapValue); CacheKey cacheKey = localCacheView.toCacheKey(mapKey); + cachePut(cacheKey, t.getKey(), t.getValue()); hashes[i] = cacheKey.getKeyHash(); i++; - clonedMap.put(t.getKey(), t.getValue()); } ByteBuf msgEncoded = null; @@ -782,12 +782,7 @@ public class RedissonLocalCachedMap extends RedissonMap implements R + "end;", Arrays.asList(getRawName(), listener.getInvalidationTopicName(), listener.getUpdatesLogName()), params.toArray()); - - CompletionStage f = future.thenApply(res -> { - cacheMap(clonedMap); - return null; - }); - return new CompletableFutureWrapper<>(f); + return new CompletableFutureWrapper<>(future); } @Override