addAndGetAsync(K key, Number value) {
- if (key == null) {
- throw new NullPointerException("map key can't be null");
- }
- if (value == null) {
- throw new NullPointerException("map value can't be null");
- }
+ checkKey(key);
+ checkValue(value);
byte[] keyState = encodeMapKey(key);
return commandExecutor.writeAsync(getName(key), StringCodec.INSTANCE,
diff --git a/redisson/src/main/java/org/redisson/RedissonMapCache.java b/redisson/src/main/java/org/redisson/RedissonMapCache.java
index 049dff84c..c60f449bb 100644
--- a/redisson/src/main/java/org/redisson/RedissonMapCache.java
+++ b/redisson/src/main/java/org/redisson/RedissonMapCache.java
@@ -15,6 +15,8 @@
*/
package org.redisson;
+import java.io.IOException;
+import java.math.BigDecimal;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.Arrays;
@@ -23,19 +25,27 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.redisson.api.RFuture;
import org.redisson.api.RMapCache;
+import org.redisson.api.RTopic;
import org.redisson.api.RedissonClient;
+import org.redisson.api.listener.MessageListener;
+import org.redisson.api.map.event.EntryCreatedListener;
+import org.redisson.api.map.event.EntryEvent;
+import org.redisson.api.map.event.EntryExpiredListener;
+import org.redisson.api.map.event.EntryRemovedListener;
+import org.redisson.api.map.event.EntryUpdatedListener;
+import org.redisson.api.map.event.MapEntryListener;
import org.redisson.client.codec.Codec;
import org.redisson.client.codec.LongCodec;
import org.redisson.client.codec.MapScanCodec;
+import org.redisson.client.codec.StringCodec;
import org.redisson.client.protocol.RedisCommand;
import org.redisson.client.protocol.RedisCommand.ValueType;
import org.redisson.client.protocol.RedisCommands;
-import org.redisson.client.protocol.convertor.BooleanReplayConvertor;
+import org.redisson.client.protocol.convertor.NumberConvertor;
import org.redisson.client.protocol.convertor.VoidReplayConvertor;
import org.redisson.client.protocol.decoder.ListMultiDecoder;
import org.redisson.client.protocol.decoder.LongMultiDecoder;
@@ -45,16 +55,13 @@ import org.redisson.client.protocol.decoder.MapScanResult;
import org.redisson.client.protocol.decoder.ObjectListDecoder;
import org.redisson.client.protocol.decoder.ObjectMapDecoder;
import org.redisson.client.protocol.decoder.ScanObjectEntry;
+import org.redisson.codec.MapCacheEventCodec;
import org.redisson.command.CommandAsyncExecutor;
import org.redisson.connection.decoder.MapGetAllDecoder;
import org.redisson.eviction.EvictionScheduler;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.FutureListener;
-import java.io.IOException;
-import java.math.BigDecimal;
-import org.redisson.client.codec.StringCodec;
-import org.redisson.client.protocol.convertor.NumberConvertor;
/**
* Map-based cache with ability to set TTL for each entry via
@@ -77,43 +84,39 @@ import org.redisson.client.protocol.convertor.NumberConvertor;
*/
public class RedissonMapCache extends RedissonMap implements RMapCache {
- static final RedisCommand EVAL_PUT_IF_ABSENT = new RedisCommand("EVAL", new BooleanReplayConvertor(), 7, ValueType.MAP);
- static final RedisCommand EVAL_HSET = new RedisCommand("EVAL", new BooleanReplayConvertor(), 4, ValueType.MAP);
- static final RedisCommand