diff --git a/src/main/java/org/springframework/data/redis/core/AbstractOperations.java b/src/main/java/org/springframework/data/redis/core/AbstractOperations.java index 6e9e5c39b..616fc4992 100644 --- a/src/main/java/org/springframework/data/redis/core/AbstractOperations.java +++ b/src/main/java/org/springframework/data/redis/core/AbstractOperations.java @@ -93,8 +93,8 @@ abstract class AbstractOperations { } @Nullable - T execute(RedisCallback callback, boolean exposeConnection) { - return template.execute(callback, exposeConnection); + T execute(RedisCallback callback) { + return template.execute(callback, true); } public RedisOperations getOperations() { diff --git a/src/main/java/org/springframework/data/redis/core/DefaultClusterOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultClusterOperations.java index 4b23f1e39..41d9538ac 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultClusterOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultClusterOperations.java @@ -59,7 +59,7 @@ class DefaultClusterOperations extends AbstractOperations implements Assert.notNull(node, "ClusterNode must not be null."); - return execute(connection -> deserializeKeys(connection.keys(node, rawKey(pattern)))); + return doInCluster(connection -> deserializeKeys(connection.keys(node, rawKey(pattern)))); } /* @@ -71,7 +71,7 @@ class DefaultClusterOperations extends AbstractOperations implements Assert.notNull(node, "ClusterNode must not be null."); - return execute(connection -> deserializeKey(connection.randomKey(node))); + return doInCluster(connection -> deserializeKey(connection.randomKey(node))); } /* @@ -83,7 +83,7 @@ class DefaultClusterOperations extends AbstractOperations implements Assert.notNull(node, "ClusterNode must not be null."); - return execute(connection -> connection.ping(node)); + return doInCluster(connection -> connection.ping(node)); } /* @@ -95,7 +95,7 @@ class DefaultClusterOperations extends AbstractOperations implements Assert.notNull(node, "ClusterNode must not be null."); - execute((RedisClusterCallback) connection -> { + doInCluster((RedisClusterCallback) connection -> { connection.clusterAddSlots(node, slots); return null; }); @@ -123,7 +123,7 @@ class DefaultClusterOperations extends AbstractOperations implements Assert.notNull(node, "ClusterNode must not be null."); - execute((RedisClusterCallback) connection -> { + doInCluster((RedisClusterCallback) connection -> { connection.bgReWriteAof(node); return null; }); @@ -138,7 +138,7 @@ class DefaultClusterOperations extends AbstractOperations implements Assert.notNull(node, "ClusterNode must not be null."); - execute((RedisClusterCallback) connection -> { + doInCluster((RedisClusterCallback) connection -> { connection.bgSave(node); return null; }); @@ -153,7 +153,7 @@ class DefaultClusterOperations extends AbstractOperations implements Assert.notNull(node, "ClusterNode must not be null."); - execute((RedisClusterCallback) connection -> { + doInCluster((RedisClusterCallback) connection -> { connection.clusterMeet(node); return null; }); @@ -168,7 +168,7 @@ class DefaultClusterOperations extends AbstractOperations implements Assert.notNull(node, "ClusterNode must not be null."); - execute((RedisClusterCallback) connection -> { + doInCluster((RedisClusterCallback) connection -> { connection.clusterForget(node); return null; }); @@ -183,7 +183,7 @@ class DefaultClusterOperations extends AbstractOperations implements Assert.notNull(node, "ClusterNode must not be null."); - execute((RedisClusterCallback) connection -> { + doInCluster((RedisClusterCallback) connection -> { connection.flushDb(node); return null; }); @@ -198,7 +198,7 @@ class DefaultClusterOperations extends AbstractOperations implements Assert.notNull(node, "ClusterNode must not be null."); - return execute(connection -> connection.clusterGetSlaves(node)); + return doInCluster(connection -> connection.clusterGetSlaves(node)); } /* @@ -210,7 +210,7 @@ class DefaultClusterOperations extends AbstractOperations implements Assert.notNull(node, "ClusterNode must not be null."); - execute((RedisClusterCallback) connection -> { + doInCluster((RedisClusterCallback) connection -> { connection.save(node); return null; }); @@ -225,7 +225,7 @@ class DefaultClusterOperations extends AbstractOperations implements Assert.notNull(node, "ClusterNode must not be null."); - execute((RedisClusterCallback) connection -> { + doInCluster((RedisClusterCallback) connection -> { connection.shutdown(node); return null; }); @@ -241,7 +241,7 @@ class DefaultClusterOperations extends AbstractOperations implements Assert.notNull(source, "Source node must not be null."); Assert.notNull(target, "Target node must not be null."); - execute((RedisClusterCallback) connection -> { + doInCluster((RedisClusterCallback) connection -> { connection.clusterSetSlot(target, slot, AddSlots.IMPORTING); connection.clusterSetSlot(source, slot, AddSlots.MIGRATING); @@ -262,16 +262,13 @@ class DefaultClusterOperations extends AbstractOperations implements * @return execution result. Can be {@literal null}. */ @Nullable - public T execute(RedisClusterCallback callback) { + T doInCluster(RedisClusterCallback callback) { Assert.notNull(callback, "ClusterCallback must not be null!"); - RedisClusterConnection connection = template.getConnectionFactory().getClusterConnection(); - - try { + try (RedisClusterConnection connection = template.getConnectionFactory().getClusterConnection()) { return callback.doInRedis(connection); - } finally { - connection.close(); } } + } diff --git a/src/main/java/org/springframework/data/redis/core/DefaultGeoOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultGeoOperations.java index deb2009d9..cb10bd26e 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultGeoOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultGeoOperations.java @@ -61,7 +61,7 @@ class DefaultGeoOperations extends AbstractOperations implements Geo byte[] rawKey = rawKey(key); byte[] rawMember = rawValue(member); - return execute(connection -> connection.geoAdd(rawKey, point, rawMember), true); + return execute(connection -> connection.geoAdd(rawKey, point, rawMember)); } /* @@ -88,7 +88,7 @@ class DefaultGeoOperations extends AbstractOperations implements Geo rawMemberCoordinateMap.put(rawMember, memberCoordinateMap.get(member)); } - return execute(connection -> connection.geoAdd(rawKey, rawMemberCoordinateMap), true); + return execute(connection -> connection.geoAdd(rawKey, rawMemberCoordinateMap)); } /* @@ -117,7 +117,7 @@ class DefaultGeoOperations extends AbstractOperations implements Geo byte[] rawMember1 = rawValue(member1); byte[] rawMember2 = rawValue(member2); - return execute(connection -> connection.geoDist(rawKey, rawMember1, rawMember2), true); + return execute(connection -> connection.geoDist(rawKey, rawMember1, rawMember2)); } /* @@ -131,7 +131,7 @@ class DefaultGeoOperations extends AbstractOperations implements Geo byte[] rawMember1 = rawValue(member1); byte[] rawMember2 = rawValue(member2); - return execute(connection -> connection.geoDist(rawKey, rawMember1, rawMember2, metric), true); + return execute(connection -> connection.geoDist(rawKey, rawMember1, rawMember2, metric)); } /* @@ -144,7 +144,7 @@ class DefaultGeoOperations extends AbstractOperations implements Geo byte[] rawKey = rawKey(key); byte[][] rawMembers = rawValues(members); - return execute(connection -> connection.geoHash(rawKey, rawMembers), true); + return execute(connection -> connection.geoHash(rawKey, rawMembers)); } /* @@ -156,7 +156,7 @@ class DefaultGeoOperations extends AbstractOperations implements Geo byte[] rawKey = rawKey(key); byte[][] rawMembers = rawValues(members); - return execute(connection -> connection.geoPos(rawKey, rawMembers), true); + return execute(connection -> connection.geoPos(rawKey, rawMembers)); } /* @@ -168,7 +168,7 @@ class DefaultGeoOperations extends AbstractOperations implements Geo byte[] rawKey = rawKey(key); - GeoResults> raw = execute(connection -> connection.geoRadius(rawKey, within), true); + GeoResults> raw = execute(connection -> connection.geoRadius(rawKey, within)); return deserializeGeoResults(raw); } @@ -182,7 +182,7 @@ class DefaultGeoOperations extends AbstractOperations implements Geo byte[] rawKey = rawKey(key); - GeoResults> raw = execute(connection -> connection.geoRadius(rawKey, within, args), true); + GeoResults> raw = execute(connection -> connection.geoRadius(rawKey, within, args)); return deserializeGeoResults(raw); } @@ -196,8 +196,8 @@ class DefaultGeoOperations extends AbstractOperations implements Geo byte[] rawKey = rawKey(key); byte[] rawMember = rawValue(member); - GeoResults> raw = execute(connection -> connection.geoRadiusByMember(rawKey, rawMember, radius), - true); + GeoResults> raw = execute( + connection -> connection.geoRadiusByMember(rawKey, rawMember, radius)); return deserializeGeoResults(raw); } @@ -213,7 +213,7 @@ class DefaultGeoOperations extends AbstractOperations implements Geo byte[] rawMember = rawValue(member); GeoResults> raw = execute( - connection -> connection.geoRadiusByMember(rawKey, rawMember, distance), true); + connection -> connection.geoRadiusByMember(rawKey, rawMember, distance)); return deserializeGeoResults(raw); } @@ -229,7 +229,7 @@ class DefaultGeoOperations extends AbstractOperations implements Geo byte[] rawMember = rawValue(member); GeoResults> raw = execute( - connection -> connection.geoRadiusByMember(rawKey, rawMember, distance, param), true); + connection -> connection.geoRadiusByMember(rawKey, rawMember, distance, param)); return deserializeGeoResults(raw); } @@ -243,10 +243,10 @@ class DefaultGeoOperations extends AbstractOperations implements Geo byte[] rawKey = rawKey(key); byte[][] rawMembers = rawValues(members); - return execute(connection -> connection.zRem(rawKey, rawMembers), true); + return execute(connection -> connection.zRem(rawKey, rawMembers)); } - /* + /* * (non-Javadoc) * @see org.springframework.data.redis.core.GeoOperations#search(java.lang.Object, org.springframework.data.redis.connection.RedisGeoCommands.GeoReference, org.springframework.data.redis.connection.RedisGeoCommands.GeoShape, org.springframework.data.redis.connection.RedisGeoCommands.GeoSearchCommandArgs) */ @@ -258,12 +258,12 @@ class DefaultGeoOperations extends AbstractOperations implements Geo GeoReference rawMember = getGeoReference(reference); GeoResults> raw = execute( - connection -> connection.geoSearch(rawKey, rawMember, geoPredicate, args), true); + connection -> connection.geoSearch(rawKey, rawMember, geoPredicate, args)); return deserializeGeoResults(raw); } - /* + /* * (non-Javadoc) * @see org.springframework.data.redis.core.GeoOperations#searchAndStore(java.lang.Object, java.lang.Object, org.springframework.data.redis.connection.RedisGeoCommands.GeoReference, org.springframework.data.redis.connection.RedisGeoCommands.GeoShape, org.springframework.data.redis.connection.RedisGeoCommands.GeoSearchStoreCommandArgs) */ @@ -275,7 +275,7 @@ class DefaultGeoOperations extends AbstractOperations implements Geo byte[] rawDestKey = rawKey(destKey); GeoReference rawMember = getGeoReference(reference); - return execute(connection -> connection.geoSearchStore(rawDestKey, rawKey, rawMember, geoPredicate, args), true); + return execute(connection -> connection.geoSearchStore(rawDestKey, rawKey, rawMember, geoPredicate, args)); } @SuppressWarnings("unchecked") diff --git a/src/main/java/org/springframework/data/redis/core/DefaultHashOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultHashOperations.java index 45f493630..86868f792 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultHashOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultHashOperations.java @@ -52,7 +52,7 @@ class DefaultHashOperations extends AbstractOperations imp byte[] rawKey = rawKey(key); byte[] rawHashKey = rawHashKey(hashKey); - byte[] rawHashValue = execute(connection -> connection.hGet(rawKey, rawHashKey), true); + byte[] rawHashValue = execute(connection -> connection.hGet(rawKey, rawHashKey)); return (HV) rawHashValue != null ? deserializeHashValue(rawHashValue) : null; } @@ -66,7 +66,7 @@ class DefaultHashOperations extends AbstractOperations imp byte[] rawKey = rawKey(key); byte[] rawHashKey = rawHashKey(hashKey); - return execute(connection -> connection.hExists(rawKey, rawHashKey), true); + return execute(connection -> connection.hExists(rawKey, rawHashKey)); } /* @@ -78,7 +78,7 @@ class DefaultHashOperations extends AbstractOperations imp byte[] rawKey = rawKey(key); byte[] rawHashKey = rawHashKey(hashKey); - return execute(connection -> connection.hIncrBy(rawKey, rawHashKey, delta), true); + return execute(connection -> connection.hIncrBy(rawKey, rawHashKey, delta)); } /* @@ -90,10 +90,10 @@ class DefaultHashOperations extends AbstractOperations imp byte[] rawKey = rawKey(key); byte[] rawHashKey = rawHashKey(hashKey); - return execute(connection -> connection.hIncrBy(rawKey, rawHashKey, delta), true); + return execute(connection -> connection.hIncrBy(rawKey, rawHashKey, delta)); } - /* + /* * (non-Javadoc) * @see org.springframework.data.redis.core.HashOperations#randomField(java.lang.Object) */ @@ -102,10 +102,10 @@ class DefaultHashOperations extends AbstractOperations imp public HK randomKey(K key) { byte[] rawKey = rawKey(key); - return deserializeHashKey(execute(connection -> connection.hRandField(rawKey), true)); + return deserializeHashKey(execute(connection -> connection.hRandField(rawKey))); } - /* + /* * (non-Javadoc) * @see org.springframework.data.redis.core.HashOperations#randomValue(java.lang.Object) */ @@ -114,12 +114,12 @@ class DefaultHashOperations extends AbstractOperations imp public Entry randomEntry(K key) { byte[] rawKey = rawKey(key); - Entry rawEntry = execute(connection -> connection.hRandFieldWithValues(rawKey), true); + Entry rawEntry = execute(connection -> connection.hRandFieldWithValues(rawKey)); return rawEntry == null ? null : Converters.entryOf(deserializeHashKey(rawEntry.getKey()), deserializeHashValue(rawEntry.getValue())); } - /* + /* * (non-Javadoc) * @see org.springframework.data.redis.core.HashOperations#randomFields(java.lang.Object, long) */ @@ -128,11 +128,11 @@ class DefaultHashOperations extends AbstractOperations imp public List randomKeys(K key, long count) { byte[] rawKey = rawKey(key); - List rawValues = execute(connection -> connection.hRandField(rawKey, count), true); + List rawValues = execute(connection -> connection.hRandField(rawKey, count)); return deserializeHashKeys(rawValues); } - /* + /* * (non-Javadoc) * @see org.springframework.data.redis.core.HashOperations#randomValues(java.lang.Object, long) */ @@ -142,8 +142,7 @@ class DefaultHashOperations extends AbstractOperations imp Assert.isTrue(count > 0, "Count must not be negative"); byte[] rawKey = rawKey(key); - List> rawEntries = execute(connection -> connection.hRandFieldWithValues(rawKey, count), - true); + List> rawEntries = execute(connection -> connection.hRandFieldWithValues(rawKey, count)); if (rawEntries == null) { return null; @@ -162,7 +161,7 @@ class DefaultHashOperations extends AbstractOperations imp public Set keys(K key) { byte[] rawKey = rawKey(key); - Set rawValues = execute(connection -> connection.hKeys(rawKey), true); + Set rawValues = execute(connection -> connection.hKeys(rawKey)); return rawValues != null ? deserializeHashKeys(rawValues) : Collections.emptySet(); } @@ -175,7 +174,7 @@ class DefaultHashOperations extends AbstractOperations imp public Long size(K key) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.hLen(rawKey), true); + return execute(connection -> connection.hLen(rawKey)); } /* @@ -188,7 +187,7 @@ class DefaultHashOperations extends AbstractOperations imp byte[] rawKey = rawKey(key); byte[] rawHashKey = rawHashKey(hashKey); - return execute(connection -> connection.hStrLen(rawKey, rawHashKey), true); + return execute(connection -> connection.hStrLen(rawKey, rawHashKey)); } /* @@ -213,7 +212,7 @@ class DefaultHashOperations extends AbstractOperations imp execute(connection -> { connection.hMSet(rawKey, hashes); return null; - }, true); + }); } /* @@ -235,7 +234,7 @@ class DefaultHashOperations extends AbstractOperations imp rawHashKeys[counter++] = rawHashKey(hashKey); } - List rawValues = execute(connection -> connection.hMGet(rawKey, rawHashKeys), true); + List rawValues = execute(connection -> connection.hMGet(rawKey, rawHashKeys)); return deserializeHashValues(rawValues); } @@ -254,7 +253,7 @@ class DefaultHashOperations extends AbstractOperations imp execute(connection -> { connection.hSet(rawKey, rawHashKey, rawHashValue); return null; - }, true); + }); } /* @@ -268,7 +267,7 @@ class DefaultHashOperations extends AbstractOperations imp byte[] rawHashKey = rawHashKey(hashKey); byte[] rawHashValue = rawHashValue(value); - return execute(connection -> connection.hSetNX(rawKey, rawHashKey, rawHashValue), true); + return execute(connection -> connection.hSetNX(rawKey, rawHashKey, rawHashValue)); } /* @@ -279,7 +278,7 @@ class DefaultHashOperations extends AbstractOperations imp public List values(K key) { byte[] rawKey = rawKey(key); - List rawValues = execute(connection -> connection.hVals(rawKey), true); + List rawValues = execute(connection -> connection.hVals(rawKey)); return rawValues != null ? deserializeHashValues(rawValues) : Collections.emptyList(); } @@ -294,7 +293,7 @@ class DefaultHashOperations extends AbstractOperations imp byte[] rawKey = rawKey(key); byte[][] rawHashKeys = rawHashKeys(hashKeys); - return execute(connection -> connection.hDel(rawKey, rawHashKeys), true); + return execute(connection -> connection.hDel(rawKey, rawHashKeys)); } /* @@ -305,7 +304,7 @@ class DefaultHashOperations extends AbstractOperations imp public Map entries(K key) { byte[] rawKey = rawKey(key); - Map entries = execute(connection -> connection.hGetAll(rawKey), true); + Map entries = execute(connection -> connection.hGetAll(rawKey)); return entries != null ? deserializeHashMap(entries) : Collections.emptyMap(); } diff --git a/src/main/java/org/springframework/data/redis/core/DefaultHyperLogLogOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultHyperLogLogOperations.java index 5b917e62c..a39eb3106 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultHyperLogLogOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultHyperLogLogOperations.java @@ -38,7 +38,7 @@ class DefaultHyperLogLogOperations extends AbstractOperations implem byte[] rawKey = rawKey(key); byte[][] rawValues = rawValues(values); - return execute(connection -> connection.pfAdd(rawKey, rawValues), true); + return execute(connection -> connection.pfAdd(rawKey, rawValues)); } /* @@ -49,7 +49,7 @@ class DefaultHyperLogLogOperations extends AbstractOperations implem public Long size(K... keys) { byte[][] rawKeys = rawKeys(Arrays.asList(keys)); - return execute(connection -> connection.pfCount(rawKeys), true); + return execute(connection -> connection.pfCount(rawKeys)); } /* @@ -65,7 +65,7 @@ class DefaultHyperLogLogOperations extends AbstractOperations implem connection.pfMerge(rawDestinationKey, rawSourceKeys); return connection.pfCount(rawDestinationKey); - }, true); + }); } /* diff --git a/src/main/java/org/springframework/data/redis/core/DefaultListOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultListOperations.java index db434929d..105115a8e 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultListOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultListOperations.java @@ -52,7 +52,7 @@ class DefaultListOperations extends AbstractOperations implements Li protected byte[] inRedis(byte[] rawKey, RedisConnection connection) { return connection.lIndex(rawKey, index); } - }, true); + }); } /* @@ -64,7 +64,7 @@ class DefaultListOperations extends AbstractOperations implements Li byte[] rawKey = rawKey(key); byte[] rawValue = rawValue(value); - return execute(connection -> connection.lPos(rawKey, rawValue), true); + return execute(connection -> connection.lPos(rawKey, rawValue)); } /* @@ -80,7 +80,7 @@ class DefaultListOperations extends AbstractOperations implements Li List indexes = connection.lPos(rawKey, rawValue, -1, null); return CollectionUtils.firstElement(indexes); - }, true); + }); } /* @@ -96,7 +96,7 @@ class DefaultListOperations extends AbstractOperations implements Li protected byte[] inRedis(byte[] rawKey, RedisConnection connection) { return connection.lPop(rawKey); } - }, true); + }); } /* @@ -106,7 +106,7 @@ class DefaultListOperations extends AbstractOperations implements Li @Override public List leftPop(K key, long count) { byte[] rawKey = rawKey(key); - return execute(connection -> deserializeValues(connection.lPop(rawKey, count)), true); + return execute(connection -> deserializeValues(connection.lPop(rawKey, count))); } /* @@ -124,7 +124,7 @@ class DefaultListOperations extends AbstractOperations implements Li List lPop = connection.bLPop(tm, rawKey); return (CollectionUtils.isEmpty(lPop) ? null : lPop.get(1)); } - }, true); + }); } /* @@ -136,7 +136,7 @@ class DefaultListOperations extends AbstractOperations implements Li byte[] rawKey = rawKey(key); byte[] rawValue = rawValue(value); - return execute(connection -> connection.lPush(rawKey, rawValue), true); + return execute(connection -> connection.lPush(rawKey, rawValue)); } /* @@ -148,7 +148,7 @@ class DefaultListOperations extends AbstractOperations implements Li byte[] rawKey = rawKey(key); byte[][] rawValues = rawValues(values); - return execute(connection -> connection.lPush(rawKey, rawValues), true); + return execute(connection -> connection.lPush(rawKey, rawValues)); } /* @@ -161,7 +161,7 @@ class DefaultListOperations extends AbstractOperations implements Li byte[] rawKey = rawKey(key); byte[][] rawValues = rawValues(values); - return execute(connection -> connection.lPush(rawKey, rawValues), true); + return execute(connection -> connection.lPush(rawKey, rawValues)); } /* @@ -173,7 +173,7 @@ class DefaultListOperations extends AbstractOperations implements Li byte[] rawKey = rawKey(key); byte[] rawValue = rawValue(value); - return execute(connection -> connection.lPushX(rawKey, rawValue), true); + return execute(connection -> connection.lPushX(rawKey, rawValue)); } /* @@ -186,7 +186,7 @@ class DefaultListOperations extends AbstractOperations implements Li byte[] rawKey = rawKey(key); byte[] rawPivot = rawValue(pivot); byte[] rawValue = rawValue(value); - return execute(connection -> connection.lInsert(rawKey, Position.BEFORE, rawPivot, rawValue), true); + return execute(connection -> connection.lInsert(rawKey, Position.BEFORE, rawPivot, rawValue)); } /* @@ -197,7 +197,7 @@ class DefaultListOperations extends AbstractOperations implements Li public Long size(K key) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.lLen(rawKey), true); + return execute(connection -> connection.lLen(rawKey)); } /* @@ -208,7 +208,7 @@ class DefaultListOperations extends AbstractOperations implements Li public List range(K key, long start, long end) { byte[] rawKey = rawKey(key); - return execute(connection -> deserializeValues(connection.lRange(rawKey, start, end)), true); + return execute(connection -> deserializeValues(connection.lRange(rawKey, start, end))); } /* @@ -220,7 +220,7 @@ class DefaultListOperations extends AbstractOperations implements Li byte[] rawKey = rawKey(key); byte[] rawValue = rawValue(value); - return execute(connection -> connection.lRem(rawKey, count, rawValue), true); + return execute(connection -> connection.lRem(rawKey, count, rawValue)); } /* @@ -236,7 +236,7 @@ class DefaultListOperations extends AbstractOperations implements Li protected byte[] inRedis(byte[] rawKey, RedisConnection connection) { return connection.rPop(rawKey); } - }, true); + }); } /* @@ -246,7 +246,7 @@ class DefaultListOperations extends AbstractOperations implements Li @Override public List rightPop(K key, long count) { byte[] rawKey = rawKey(key); - return execute(connection -> deserializeValues(connection.rPop(rawKey, count)), true); + return execute(connection -> deserializeValues(connection.rPop(rawKey, count))); } /* @@ -265,7 +265,7 @@ class DefaultListOperations extends AbstractOperations implements Li List bRPop = connection.bRPop(tm, rawKey); return (CollectionUtils.isEmpty(bRPop) ? null : bRPop.get(1)); } - }, true); + }); } /* @@ -277,7 +277,7 @@ class DefaultListOperations extends AbstractOperations implements Li byte[] rawKey = rawKey(key); byte[] rawValue = rawValue(value); - return execute(connection -> connection.rPush(rawKey, rawValue), true); + return execute(connection -> connection.rPush(rawKey, rawValue)); } /* @@ -289,7 +289,7 @@ class DefaultListOperations extends AbstractOperations implements Li byte[] rawKey = rawKey(key); byte[][] rawValues = rawValues(values); - return execute(connection -> connection.rPush(rawKey, rawValues), true); + return execute(connection -> connection.rPush(rawKey, rawValues)); } /* @@ -301,7 +301,7 @@ class DefaultListOperations extends AbstractOperations implements Li byte[] rawKey = rawKey(key); byte[][] rawValues = rawValues(values); - return execute(connection -> connection.rPush(rawKey, rawValues), true); + return execute(connection -> connection.rPush(rawKey, rawValues)); } /* @@ -313,7 +313,7 @@ class DefaultListOperations extends AbstractOperations implements Li byte[] rawKey = rawKey(key); byte[] rawValue = rawValue(value); - return execute(connection -> connection.rPushX(rawKey, rawValue), true); + return execute(connection -> connection.rPushX(rawKey, rawValue)); } /* @@ -326,7 +326,7 @@ class DefaultListOperations extends AbstractOperations implements Li byte[] rawKey = rawKey(key); byte[] rawPivot = rawValue(pivot); byte[] rawValue = rawValue(value); - return execute(connection -> connection.lInsert(rawKey, Position.AFTER, rawPivot, rawValue), true); + return execute(connection -> connection.lInsert(rawKey, Position.AFTER, rawPivot, rawValue)); } /* @@ -343,7 +343,7 @@ class DefaultListOperations extends AbstractOperations implements Li protected byte[] inRedis(byte[] rawSourceKey, RedisConnection connection) { return connection.rPopLPush(rawSourceKey, rawDestKey); } - }, true); + }); } /* @@ -361,10 +361,10 @@ class DefaultListOperations extends AbstractOperations implements Li protected byte[] inRedis(byte[] rawSourceKey, RedisConnection connection) { return connection.bRPopLPush(tm, rawSourceKey, rawDestKey); } - }, true); + }); } - /* + /* * (non-Javadoc) * @see org.springframework.data.redis.core.ListOperations#move(java.lang.Object, org.springframework.data.redis.connection.RedisListCommands.Direction, java.lang.Object, org.springframework.data.redis.connection.RedisListCommands.Direction) */ @@ -378,10 +378,10 @@ class DefaultListOperations extends AbstractOperations implements Li protected byte[] inRedis(byte[] rawSourceKey, RedisConnection connection) { return connection.lMove(rawSourceKey, rawDestKey, from, to); } - }, true); + }); } - /* + /* * (non-Javadoc) * @see org.springframework.data.redis.core.ListOperations#move(java.lang.Object, org.springframework.data.redis.connection.RedisListCommands.Direction, java.lang.Object, org.springframework.data.redis.connection.RedisListCommands.Direction, long, java.util.concurrent.TimeUnit) */ @@ -395,7 +395,7 @@ class DefaultListOperations extends AbstractOperations implements Li protected byte[] inRedis(byte[] rawSourceKey, RedisConnection connection) { return connection.bLMove(rawSourceKey, rawDestKey, from, to, TimeoutUtils.toDoubleSeconds(timeout, unit)); } - }, true); + }); } /* @@ -413,7 +413,7 @@ class DefaultListOperations extends AbstractOperations implements Li connection.lSet(rawKey, index, rawValue); return null; } - }, true); + }); } /* @@ -430,6 +430,6 @@ class DefaultListOperations extends AbstractOperations implements Li connection.lTrim(rawKey, start, end); return null; } - }, true); + }); } } diff --git a/src/main/java/org/springframework/data/redis/core/DefaultSetOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultSetOperations.java index bf3e37a69..d4f7d00b4 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultSetOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultSetOperations.java @@ -49,7 +49,7 @@ class DefaultSetOperations extends AbstractOperations implements Set byte[] rawKey = rawKey(key); byte[][] rawValues = rawValues((Object[]) values); - return execute(connection -> connection.sAdd(rawKey, rawValues), true); + return execute(connection -> connection.sAdd(rawKey, rawValues)); } /* @@ -69,7 +69,7 @@ class DefaultSetOperations extends AbstractOperations implements Set public Set difference(K key, Collection otherKeys) { byte[][] rawKeys = rawKeys(key, otherKeys); - Set rawValues = execute(connection -> connection.sDiff(rawKeys), true); + Set rawValues = execute(connection -> connection.sDiff(rawKeys)); return deserializeValues(rawValues); } @@ -82,7 +82,7 @@ class DefaultSetOperations extends AbstractOperations implements Set public Set difference(Collection keys) { byte[][] rawKeys = rawKeys(keys); - Set rawValues = execute(connection -> connection.sDiff(rawKeys), true); + Set rawValues = execute(connection -> connection.sDiff(rawKeys)); return deserializeValues(rawValues); } @@ -106,7 +106,7 @@ class DefaultSetOperations extends AbstractOperations implements Set byte[][] rawKeys = rawKeys(key, otherKeys); byte[] rawDestKey = rawKey(destKey); - return execute(connection -> connection.sDiffStore(rawDestKey, rawKeys), true); + return execute(connection -> connection.sDiffStore(rawDestKey, rawKeys)); } /* @@ -119,7 +119,7 @@ class DefaultSetOperations extends AbstractOperations implements Set byte[][] rawKeys = rawKeys(keys); byte[] rawDestKey = rawKey(destKey); - return execute(connection -> connection.sDiffStore(rawDestKey, rawKeys), true); + return execute(connection -> connection.sDiffStore(rawDestKey, rawKeys)); } /* @@ -139,7 +139,7 @@ class DefaultSetOperations extends AbstractOperations implements Set public Set intersect(K key, Collection otherKeys) { byte[][] rawKeys = rawKeys(key, otherKeys); - Set rawValues = execute(connection -> connection.sInter(rawKeys), true); + Set rawValues = execute(connection -> connection.sInter(rawKeys)); return deserializeValues(rawValues); } @@ -152,7 +152,7 @@ class DefaultSetOperations extends AbstractOperations implements Set public Set intersect(Collection keys) { byte[][] rawKeys = rawKeys(keys); - Set rawValues = execute(connection -> connection.sInter(rawKeys), true); + Set rawValues = execute(connection -> connection.sInter(rawKeys)); return deserializeValues(rawValues); } @@ -176,7 +176,7 @@ class DefaultSetOperations extends AbstractOperations implements Set byte[][] rawKeys = rawKeys(key, otherKeys); byte[] rawDestKey = rawKey(destKey); - return execute(connection -> connection.sInterStore(rawDestKey, rawKeys), true); + return execute(connection -> connection.sInterStore(rawDestKey, rawKeys)); } /* @@ -189,7 +189,7 @@ class DefaultSetOperations extends AbstractOperations implements Set byte[][] rawKeys = rawKeys(keys); byte[] rawDestKey = rawKey(destKey); - return execute(connection -> connection.sInterStore(rawDestKey, rawKeys), true); + return execute(connection -> connection.sInterStore(rawDestKey, rawKeys)); } /* @@ -202,7 +202,7 @@ class DefaultSetOperations extends AbstractOperations implements Set byte[] rawKey = rawKey(key); byte[] rawValue = rawValue(o); - return execute(connection -> connection.sIsMember(rawKey, rawValue), true); + return execute(connection -> connection.sIsMember(rawKey, rawValue)); } /* @@ -230,7 +230,7 @@ class DefaultSetOperations extends AbstractOperations implements Set } return isMember; - }, true); + }); } /* @@ -241,7 +241,7 @@ class DefaultSetOperations extends AbstractOperations implements Set public Set members(K key) { byte[] rawKey = rawKey(key); - Set rawValues = execute(connection -> connection.sMembers(rawKey), true); + Set rawValues = execute(connection -> connection.sMembers(rawKey)); return deserializeValues(rawValues); } @@ -257,7 +257,7 @@ class DefaultSetOperations extends AbstractOperations implements Set byte[] rawDestKey = rawKey(destKey); byte[] rawValue = rawValue(value); - return execute(connection -> connection.sMove(rawKey, rawDestKey, rawValue), true); + return execute(connection -> connection.sMove(rawKey, rawDestKey, rawValue)); } /* @@ -273,7 +273,7 @@ class DefaultSetOperations extends AbstractOperations implements Set protected byte[] inRedis(byte[] rawKey, RedisConnection connection) { return connection.sRandMember(rawKey); } - }, true); + }); } /* @@ -287,7 +287,7 @@ class DefaultSetOperations extends AbstractOperations implements Set byte[] rawKey = rawKey(key); Set rawValues = execute( - (RedisCallback>) connection -> new HashSet<>(connection.sRandMember(rawKey, count)), true); + (RedisCallback>) connection -> new HashSet<>(connection.sRandMember(rawKey, count))); return deserializeValues(rawValues); } @@ -303,7 +303,7 @@ class DefaultSetOperations extends AbstractOperations implements Set "Use a positive number for count. " + "This method is already allowing duplicate elements."); byte[] rawKey = rawKey(key); - List rawValues = execute(connection -> connection.sRandMember(rawKey, -count), true); + List rawValues = execute(connection -> connection.sRandMember(rawKey, -count)); return deserializeValues(rawValues); } @@ -317,7 +317,7 @@ class DefaultSetOperations extends AbstractOperations implements Set byte[] rawKey = rawKey(key); byte[][] rawValues = rawValues(values); - return execute(connection -> connection.sRem(rawKey, rawValues), true); + return execute(connection -> connection.sRem(rawKey, rawValues)); } /* @@ -333,7 +333,7 @@ class DefaultSetOperations extends AbstractOperations implements Set protected byte[] inRedis(byte[] rawKey, RedisConnection connection) { return connection.sPop(rawKey); } - }, true); + }); } /* @@ -344,7 +344,7 @@ class DefaultSetOperations extends AbstractOperations implements Set public List pop(K key, long count) { byte[] rawKey = rawKey(key); - List rawValues = execute(connection -> connection.sPop(rawKey, count), true); + List rawValues = execute(connection -> connection.sPop(rawKey, count)); return deserializeValues(rawValues); } @@ -357,7 +357,7 @@ class DefaultSetOperations extends AbstractOperations implements Set public Long size(K key) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.sCard(rawKey), true); + return execute(connection -> connection.sCard(rawKey)); } /* @@ -377,7 +377,7 @@ class DefaultSetOperations extends AbstractOperations implements Set public Set union(K key, Collection otherKeys) { byte[][] rawKeys = rawKeys(key, otherKeys); - Set rawValues = execute(connection -> connection.sUnion(rawKeys), true); + Set rawValues = execute(connection -> connection.sUnion(rawKeys)); return deserializeValues(rawValues); } @@ -390,7 +390,7 @@ class DefaultSetOperations extends AbstractOperations implements Set public Set union(Collection keys) { byte[][] rawKeys = rawKeys(keys); - Set rawValues = execute(connection -> connection.sUnion(rawKeys), true); + Set rawValues = execute(connection -> connection.sUnion(rawKeys)); return deserializeValues(rawValues); } @@ -414,7 +414,7 @@ class DefaultSetOperations extends AbstractOperations implements Set byte[][] rawKeys = rawKeys(key, otherKeys); byte[] rawDestKey = rawKey(destKey); - return execute(connection -> connection.sUnionStore(rawDestKey, rawKeys), true); + return execute(connection -> connection.sUnionStore(rawDestKey, rawKeys)); } /* @@ -427,7 +427,7 @@ class DefaultSetOperations extends AbstractOperations implements Set byte[][] rawKeys = rawKeys(keys); byte[] rawDestKey = rawKey(destKey); - return execute(connection -> connection.sUnionStore(rawDestKey, rawKeys), true); + return execute(connection -> connection.sUnionStore(rawDestKey, rawKeys)); } /* diff --git a/src/main/java/org/springframework/data/redis/core/DefaultStreamOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultStreamOperations.java index a71cfb338..d03baa726 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultStreamOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultStreamOperations.java @@ -119,7 +119,7 @@ class DefaultStreamOperations extends AbstractOperations i public Long acknowledge(K key, String group, String... recordIds) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.xAck(rawKey, group, recordIds), true); + return execute(connection -> connection.xAck(rawKey, group, recordIds)); } /* @@ -137,7 +137,7 @@ class DefaultStreamOperations extends AbstractOperations i ByteRecord binaryRecord = input.serialize(keySerializer(), hashKeySerializer(), hashValueSerializer()); - return execute(connection -> connection.xAdd(binaryRecord), true); + return execute(connection -> connection.xAdd(binaryRecord)); } /* @@ -148,7 +148,7 @@ class DefaultStreamOperations extends AbstractOperations i public Long delete(K key, RecordId... recordIds) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.xDel(rawKey, recordIds), true); + return execute(connection -> connection.xDel(rawKey, recordIds)); } /* @@ -159,7 +159,7 @@ class DefaultStreamOperations extends AbstractOperations i public String createGroup(K key, ReadOffset readOffset, String group) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.xGroupCreate(rawKey, group, readOffset, true), true); + return execute(connection -> connection.xGroupCreate(rawKey, group, readOffset, true)); } /* @@ -170,7 +170,7 @@ class DefaultStreamOperations extends AbstractOperations i public Boolean deleteConsumer(K key, Consumer consumer) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.xGroupDelConsumer(rawKey, consumer), true); + return execute(connection -> connection.xGroupDelConsumer(rawKey, consumer)); } /* @@ -181,7 +181,7 @@ class DefaultStreamOperations extends AbstractOperations i public Boolean destroyGroup(K key, String group) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.xGroupDestroy(rawKey, group), true); + return execute(connection -> connection.xGroupDestroy(rawKey, group)); } /* @@ -192,7 +192,7 @@ class DefaultStreamOperations extends AbstractOperations i public XInfoStream info(K key) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.xInfo(rawKey), true); + return execute(connection -> connection.xInfo(rawKey)); } /* @@ -203,7 +203,7 @@ class DefaultStreamOperations extends AbstractOperations i public XInfoConsumers consumers(K key, String group) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.xInfoConsumers(rawKey, group), true); + return execute(connection -> connection.xInfoConsumers(rawKey, group)); } /* @@ -214,7 +214,7 @@ class DefaultStreamOperations extends AbstractOperations i public XInfoGroups groups(K key) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.xInfoGroups(rawKey), true); + return execute(connection -> connection.xInfoGroups(rawKey)); } /* @@ -225,7 +225,7 @@ class DefaultStreamOperations extends AbstractOperations i public PendingMessages pending(K key, String group, Range range, long count) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.xPending(rawKey, group, range, count), true); + return execute(connection -> connection.xPending(rawKey, group, range, count)); } /* @@ -236,7 +236,7 @@ class DefaultStreamOperations extends AbstractOperations i public PendingMessages pending(K key, Consumer consumer, Range range, long count) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.xPending(rawKey, consumer, range, count), true); + return execute(connection -> connection.xPending(rawKey, consumer, range, count)); } /* @@ -247,7 +247,7 @@ class DefaultStreamOperations extends AbstractOperations i public PendingMessagesSummary pending(K key, String group) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.xPending(rawKey, group), true); + return execute(connection -> connection.xPending(rawKey, group)); } /* @@ -258,7 +258,7 @@ class DefaultStreamOperations extends AbstractOperations i public Long size(K key) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.xLen(rawKey), true); + return execute(connection -> connection.xLen(rawKey)); } /* @@ -275,7 +275,7 @@ class DefaultStreamOperations extends AbstractOperations i List inRedis(RedisConnection connection) { return connection.xRange(rawKey(key), range, limit); } - }, true); + }); } /* @@ -292,7 +292,7 @@ class DefaultStreamOperations extends AbstractOperations i List inRedis(RedisConnection connection) { return connection.xRead(readOptions, rawStreamOffsets(streams)); } - }, true); + }); } /* @@ -309,7 +309,7 @@ class DefaultStreamOperations extends AbstractOperations i List inRedis(RedisConnection connection) { return connection.xReadGroup(consumer, readOptions, rawStreamOffsets(streams)); } - }, true); + }); } /* @@ -326,20 +326,20 @@ class DefaultStreamOperations extends AbstractOperations i List inRedis(RedisConnection connection) { return connection.xRevRange(rawKey(key), range, limit); } - }, true); + }); } @Override public Long trim(K key, long count) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.xTrim(rawKey, count), true); + return execute(connection -> connection.xTrim(rawKey, count)); } @Override public Long trim(K key, long count, boolean approximateTrimming) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.xTrim(rawKey, count, approximateTrimming), true); + return execute(connection -> connection.xTrim(rawKey, count, approximateTrimming)); } @Override diff --git a/src/main/java/org/springframework/data/redis/core/DefaultValueOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultValueOperations.java index 1a9eeb03b..fb29c59b9 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultValueOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultValueOperations.java @@ -57,7 +57,7 @@ class DefaultValueOperations extends AbstractOperations implements V protected byte[] inRedis(byte[] rawKey, RedisConnection connection) { return connection.get(rawKey); } - }, true); + }); } /* @@ -74,7 +74,7 @@ class DefaultValueOperations extends AbstractOperations implements V protected byte[] inRedis(byte[] rawKey, RedisConnection connection) { return connection.getDel(rawKey); } - }, true); + }); } /* @@ -91,7 +91,7 @@ class DefaultValueOperations extends AbstractOperations implements V protected byte[] inRedis(byte[] rawKey, RedisConnection connection) { return connection.getEx(rawKey, Expiration.from(timeout, unit)); } - }, true); + }); } /* @@ -108,7 +108,7 @@ class DefaultValueOperations extends AbstractOperations implements V protected byte[] inRedis(byte[] rawKey, RedisConnection connection) { return connection.getEx(rawKey, Expiration.from(timeout)); } - }, true); + }); } /* @@ -125,7 +125,7 @@ class DefaultValueOperations extends AbstractOperations implements V protected byte[] inRedis(byte[] rawKey, RedisConnection connection) { return connection.getEx(rawKey, Expiration.persistent()); } - }, true); + }); } /* @@ -142,7 +142,7 @@ class DefaultValueOperations extends AbstractOperations implements V protected byte[] inRedis(byte[] rawKey, RedisConnection connection) { return connection.getSet(rawKey, rawValue); } - }, true); + }); } /* @@ -153,7 +153,7 @@ class DefaultValueOperations extends AbstractOperations implements V public Long increment(K key) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.incr(rawKey), true); + return execute(connection -> connection.incr(rawKey)); } /* @@ -164,7 +164,7 @@ class DefaultValueOperations extends AbstractOperations implements V public Long increment(K key, long delta) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.incrBy(rawKey, delta), true); + return execute(connection -> connection.incrBy(rawKey, delta)); } /* @@ -175,7 +175,7 @@ class DefaultValueOperations extends AbstractOperations implements V public Double increment(K key, double delta) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.incrBy(rawKey, delta), true); + return execute(connection -> connection.incrBy(rawKey, delta)); } /* @@ -186,7 +186,7 @@ class DefaultValueOperations extends AbstractOperations implements V public Long decrement(K key) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.decr(rawKey), true); + return execute(connection -> connection.decr(rawKey)); } /* @@ -197,7 +197,7 @@ class DefaultValueOperations extends AbstractOperations implements V public Long decrement(K key, long delta) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.decrBy(rawKey, delta), true); + return execute(connection -> connection.decrBy(rawKey, delta)); } /* @@ -213,7 +213,7 @@ class DefaultValueOperations extends AbstractOperations implements V return execute(connection -> { Long result = connection.append(rawKey, rawString); return (result != null) ? result.intValue() : null; - }, true); + }); } /* @@ -223,7 +223,7 @@ class DefaultValueOperations extends AbstractOperations implements V @Override public String get(K key, long start, long end) { byte[] rawKey = rawKey(key); - byte[] rawReturn = execute(connection -> connection.getRange(rawKey, start, end), true); + byte[] rawReturn = execute(connection -> connection.getRange(rawKey, start, end)); return deserializeString(rawReturn); } @@ -246,7 +246,7 @@ class DefaultValueOperations extends AbstractOperations implements V rawKeys[counter++] = rawKey(hashKey); } - List rawValues = execute(connection -> connection.mGet(rawKeys), true); + List rawValues = execute(connection -> connection.mGet(rawKeys)); return deserializeValues(rawValues); } @@ -271,7 +271,7 @@ class DefaultValueOperations extends AbstractOperations implements V execute(connection -> { connection.mSet(rawKeys); return null; - }, true); + }); } /* @@ -291,7 +291,7 @@ class DefaultValueOperations extends AbstractOperations implements V rawKeys.put(rawKey(entry.getKey()), rawValue(entry.getValue())); } - return execute(connection -> connection.mSetNX(rawKeys), true); + return execute(connection -> connection.mSetNX(rawKeys)); } /* @@ -309,7 +309,7 @@ class DefaultValueOperations extends AbstractOperations implements V connection.set(rawKey, rawValue); return null; } - }, true); + }); } /* @@ -350,7 +350,7 @@ class DefaultValueOperations extends AbstractOperations implements V return !failed; } - }, true); + }); } /* @@ -362,7 +362,7 @@ class DefaultValueOperations extends AbstractOperations implements V byte[] rawKey = rawKey(key); byte[] rawValue = rawValue(value); - return execute(connection -> connection.setNX(rawKey, rawValue), true); + return execute(connection -> connection.setNX(rawKey, rawValue)); } /* @@ -376,7 +376,7 @@ class DefaultValueOperations extends AbstractOperations implements V byte[] rawValue = rawValue(value); Expiration expiration = Expiration.from(timeout, unit); - return execute(connection -> connection.set(rawKey, rawValue, expiration, SetOption.ifAbsent()), true); + return execute(connection -> connection.set(rawKey, rawValue, expiration, SetOption.ifAbsent())); } /* @@ -390,7 +390,7 @@ class DefaultValueOperations extends AbstractOperations implements V byte[] rawKey = rawKey(key); byte[] rawValue = rawValue(value); - return execute(connection -> connection.set(rawKey, rawValue, Expiration.persistent(), SetOption.ifPresent()), true); + return execute(connection -> connection.set(rawKey, rawValue, Expiration.persistent(), SetOption.ifPresent())); } /* @@ -405,7 +405,7 @@ class DefaultValueOperations extends AbstractOperations implements V byte[] rawValue = rawValue(value); Expiration expiration = Expiration.from(timeout, unit); - return execute(connection -> connection.set(rawKey, rawValue, expiration, SetOption.ifPresent()), true); + return execute(connection -> connection.set(rawKey, rawValue, expiration, SetOption.ifPresent())); } /* @@ -421,7 +421,7 @@ class DefaultValueOperations extends AbstractOperations implements V execute(connection -> { connection.setRange(rawKey, rawValue, offset); return null; - }, true); + }); } /* @@ -432,7 +432,7 @@ class DefaultValueOperations extends AbstractOperations implements V public Long size(K key) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.strLen(rawKey), true); + return execute(connection -> connection.strLen(rawKey)); } /* @@ -443,7 +443,7 @@ class DefaultValueOperations extends AbstractOperations implements V public Boolean setBit(K key, long offset, boolean value) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.setBit(rawKey, offset, value), true); + return execute(connection -> connection.setBit(rawKey, offset, value)); } /* @@ -454,7 +454,7 @@ class DefaultValueOperations extends AbstractOperations implements V public Boolean getBit(K key, long offset) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.getBit(rawKey, offset), true); + return execute(connection -> connection.getBit(rawKey, offset)); } /* @@ -465,6 +465,6 @@ class DefaultValueOperations extends AbstractOperations implements V public List bitField(K key, final BitFieldSubCommands subCommands) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.bitField(rawKey, subCommands), true); + return execute(connection -> connection.bitField(rawKey, subCommands)); } } diff --git a/src/main/java/org/springframework/data/redis/core/DefaultZSetOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultZSetOperations.java index 4c4e58848..196500c61 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultZSetOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultZSetOperations.java @@ -57,7 +57,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS byte[] rawKey = rawKey(key); byte[] rawValue = rawValue(value); - return execute(connection -> connection.zAdd(rawKey, score, rawValue), true); + return execute(connection -> connection.zAdd(rawKey, score, rawValue)); } /* @@ -81,7 +81,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS byte[] rawKey = rawKey(key); byte[] rawValue = rawValue(value); - return execute(connection -> connection.zAdd(rawKey, score, rawValue, args), true); + return execute(connection -> connection.zAdd(rawKey, score, rawValue, args)); } /* @@ -93,7 +93,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS byte[] rawKey = rawKey(key); Set rawValues = rawTupleValues(tuples); - return execute(connection -> connection.zAdd(rawKey, rawValues), true); + return execute(connection -> connection.zAdd(rawKey, rawValues)); } /* @@ -117,7 +117,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS byte[] rawKey = rawKey(key); Set rawValues = rawTupleValues(tuples); - return execute(connection -> connection.zAdd(rawKey, rawValues, args), true); + return execute(connection -> connection.zAdd(rawKey, rawValues, args)); } /* @@ -129,7 +129,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS byte[] rawKey = rawKey(key); byte[] rawValue = rawValue(value); - return execute(connection -> connection.zIncrBy(rawKey, delta, rawValue), true); + return execute(connection -> connection.zIncrBy(rawKey, delta, rawValue)); } /* @@ -141,7 +141,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS byte[] rawKey = rawKey(key); - return deserializeValue(execute(connection -> connection.zRandMember(rawKey), true)); + return deserializeValue(execute(connection -> connection.zRandMember(rawKey))); } /* @@ -155,7 +155,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS byte[] rawKey = rawKey(key); - List result = execute(connection -> connection.zRandMember(rawKey, count), true); + List result = execute(connection -> connection.zRandMember(rawKey, count)); return result != null ? deserializeValues(new LinkedHashSet<>(result)) : null; } @@ -170,7 +170,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS byte[] rawKey = rawKey(key); - List result = execute(connection -> connection.zRandMember(rawKey, count), true); + List result = execute(connection -> connection.zRandMember(rawKey, count)); return deserializeValues(result); } @@ -183,7 +183,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS byte[] rawKey = rawKey(key); - return deserializeTuple(execute(connection -> connection.zRandMemberWithScore(rawKey), true)); + return deserializeTuple(execute(connection -> connection.zRandMemberWithScore(rawKey))); } /* @@ -197,7 +197,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS byte[] rawKey = rawKey(key); - List result = execute(connection -> connection.zRandMemberWithScore(rawKey, count), true); + List result = execute(connection -> connection.zRandMemberWithScore(rawKey, count)); return result != null ? deserializeTupleValues(new LinkedHashSet<>(result)) : null; } @@ -212,7 +212,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS byte[] rawKey = rawKey(key); - List result = execute(connection -> connection.zRandMemberWithScore(rawKey, count), true); + List result = execute(connection -> connection.zRandMemberWithScore(rawKey, count)); return result != null ? deserializeTupleValues(result) : null; } @@ -224,7 +224,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set range(K key, long start, long end) { byte[] rawKey = rawKey(key); - Set rawValues = execute(connection -> connection.zRange(rawKey, start, end), true); + Set rawValues = execute(connection -> connection.zRange(rawKey, start, end)); return deserializeValues(rawValues); } @@ -237,7 +237,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set reverseRange(K key, long start, long end) { byte[] rawKey = rawKey(key); - Set rawValues = execute(connection -> connection.zRevRange(rawKey, start, end), true); + Set rawValues = execute(connection -> connection.zRevRange(rawKey, start, end)); return deserializeValues(rawValues); } @@ -250,7 +250,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set> rangeWithScores(K key, long start, long end) { byte[] rawKey = rawKey(key); - Set rawValues = execute(connection -> connection.zRangeWithScores(rawKey, start, end), true); + Set rawValues = execute(connection -> connection.zRangeWithScores(rawKey, start, end)); return deserializeTupleValues(rawValues); } @@ -263,7 +263,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set> reverseRangeWithScores(K key, long start, long end) { byte[] rawKey = rawKey(key); - Set rawValues = execute(connection -> connection.zRevRangeWithScores(rawKey, start, end), true); + Set rawValues = execute(connection -> connection.zRevRangeWithScores(rawKey, start, end)); return deserializeTupleValues(rawValues); } @@ -276,7 +276,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set rangeByLex(K key, Range range, Limit limit) { byte[] rawKey = rawKey(key); - Set rawValues = execute(connection -> connection.zRangeByLex(rawKey, range, limit), true); + Set rawValues = execute(connection -> connection.zRangeByLex(rawKey, range, limit)); return deserializeValues(rawValues); } @@ -289,7 +289,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set reverseRangeByLex(K key, Range range, Limit limit) { byte[] rawKey = rawKey(key); - Set rawValues = execute(connection -> connection.zRevRangeByLex(rawKey, range, limit), true); + Set rawValues = execute(connection -> connection.zRevRangeByLex(rawKey, range, limit)); return deserializeValues(rawValues); } @@ -302,7 +302,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set rangeByScore(K key, double min, double max) { byte[] rawKey = rawKey(key); - Set rawValues = execute(connection -> connection.zRangeByScore(rawKey, min, max), true); + Set rawValues = execute(connection -> connection.zRangeByScore(rawKey, min, max)); return deserializeValues(rawValues); } @@ -315,7 +315,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set rangeByScore(K key, double min, double max, long offset, long count) { byte[] rawKey = rawKey(key); - Set rawValues = execute(connection -> connection.zRangeByScore(rawKey, min, max, offset, count), true); + Set rawValues = execute(connection -> connection.zRangeByScore(rawKey, min, max, offset, count)); return deserializeValues(rawValues); } @@ -328,7 +328,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set reverseRangeByScore(K key, double min, double max) { byte[] rawKey = rawKey(key); - Set rawValues = execute(connection -> connection.zRevRangeByScore(rawKey, min, max), true); + Set rawValues = execute(connection -> connection.zRevRangeByScore(rawKey, min, max)); return deserializeValues(rawValues); } @@ -341,7 +341,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set reverseRangeByScore(K key, double min, double max, long offset, long count) { byte[] rawKey = rawKey(key); - Set rawValues = execute(connection -> connection.zRevRangeByScore(rawKey, min, max, offset, count), true); + Set rawValues = execute(connection -> connection.zRevRangeByScore(rawKey, min, max, offset, count)); return deserializeValues(rawValues); } @@ -354,7 +354,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set> rangeByScoreWithScores(K key, double min, double max) { byte[] rawKey = rawKey(key); - Set rawValues = execute(connection -> connection.zRangeByScoreWithScores(rawKey, min, max), true); + Set rawValues = execute(connection -> connection.zRangeByScoreWithScores(rawKey, min, max)); return deserializeTupleValues(rawValues); } @@ -367,8 +367,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set> rangeByScoreWithScores(K key, double min, double max, long offset, long count) { byte[] rawKey = rawKey(key); - Set rawValues = execute(connection -> connection.zRangeByScoreWithScores(rawKey, min, max, offset, count), - true); + Set rawValues = execute(connection -> connection.zRangeByScoreWithScores(rawKey, min, max, offset, count)); return deserializeTupleValues(rawValues); } @@ -381,7 +380,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set> reverseRangeByScoreWithScores(K key, double min, double max) { byte[] rawKey = rawKey(key); - Set rawValues = execute(connection -> connection.zRevRangeByScoreWithScores(rawKey, min, max), true); + Set rawValues = execute(connection -> connection.zRevRangeByScoreWithScores(rawKey, min, max)); return deserializeTupleValues(rawValues); } @@ -394,8 +393,8 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set> reverseRangeByScoreWithScores(K key, double min, double max, long offset, long count) { byte[] rawKey = rawKey(key); - Set rawValues = execute(connection -> connection.zRevRangeByScoreWithScores(rawKey, min, max, offset, count), - true); + Set rawValues = execute( + connection -> connection.zRevRangeByScoreWithScores(rawKey, min, max, offset, count)); return deserializeTupleValues(rawValues); } @@ -413,7 +412,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS return execute(connection -> { Long zRank = connection.zRank(rawKey, rawValue); return (zRank != null && zRank.longValue() >= 0 ? zRank : null); - }, true); + }); } /* @@ -429,7 +428,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS return execute(connection -> { Long zRank = connection.zRevRank(rawKey, rawValue); return (zRank != null && zRank.longValue() >= 0 ? zRank : null); - }, true); + }); } /* @@ -442,7 +441,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS byte[] rawKey = rawKey(key); byte[][] rawValues = rawValues(values); - return execute(connection -> connection.zRem(rawKey, rawValues), true); + return execute(connection -> connection.zRem(rawKey, rawValues)); } /* @@ -453,7 +452,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Long removeRange(K key, long start, long end) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.zRemRange(rawKey, start, end), true); + return execute(connection -> connection.zRemRange(rawKey, start, end)); } /* @@ -464,7 +463,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Long removeRangeByLex(K key, Range range) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.zRemRangeByLex(rawKey, range), true); + return execute(connection -> connection.zRemRangeByLex(rawKey, range)); } /* @@ -475,7 +474,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Long removeRangeByScore(K key, double min, double max) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.zRemRangeByScore(rawKey, min, max), true); + return execute(connection -> connection.zRemRangeByScore(rawKey, min, max)); } /* @@ -487,7 +486,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS byte[] rawKey = rawKey(key); byte[] rawValue = rawValue(o); - return execute(connection -> connection.zScore(rawKey, rawValue), true); + return execute(connection -> connection.zScore(rawKey, rawValue)); } /* @@ -499,7 +498,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS byte[] rawKey = rawKey(key); byte[][] rawValues = rawValues(o); - return execute(connection -> connection.zMScore(rawKey, rawValues), true); + return execute(connection -> connection.zMScore(rawKey, rawValues)); } /* @@ -510,7 +509,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Long count(K key, double min, double max) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.zCount(rawKey, min, max), true); + return execute(connection -> connection.zCount(rawKey, min, max)); } /* @@ -521,7 +520,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Long lexCount(K key, Range range) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.zLexCount(rawKey, range), true); + return execute(connection -> connection.zLexCount(rawKey, range)); } /* @@ -533,7 +532,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public TypedTuple popMin(K key) { byte[] rawKey = rawKey(key); - return deserializeTuple(execute(connection -> connection.zPopMin(rawKey), true)); + return deserializeTuple(execute(connection -> connection.zPopMin(rawKey))); } /* @@ -545,7 +544,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set> popMin(K key, long count) { byte[] rawKey = rawKey(key); - Set result = execute(connection -> connection.zPopMin(rawKey, count), true); + Set result = execute(connection -> connection.zPopMin(rawKey, count)); return deserializeTupleValues(new LinkedHashSet<> (result)); } @@ -558,7 +557,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public TypedTuple popMin(K key, long timeout, TimeUnit unit) { byte[] rawKey = rawKey(key); - return deserializeTuple(execute(connection -> connection.bZPopMin(rawKey, timeout, unit), true)); + return deserializeTuple(execute(connection -> connection.bZPopMin(rawKey, timeout, unit))); } /* @@ -570,7 +569,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public TypedTuple popMax(K key) { byte[] rawKey = rawKey(key); - return deserializeTuple(execute(connection -> connection.zPopMax(rawKey), true)); + return deserializeTuple(execute(connection -> connection.zPopMax(rawKey))); } /* @@ -582,7 +581,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set> popMax(K key, long count) { byte[] rawKey = rawKey(key); - Set result =execute(connection -> connection.zPopMax(rawKey, count), true); + Set result = execute(connection -> connection.zPopMax(rawKey, count)); return deserializeTupleValues(new LinkedHashSet<>(result)); } @@ -595,7 +594,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public TypedTuple popMax(K key, long timeout, TimeUnit unit) { byte[] rawKey = rawKey(key); - return deserializeTuple(execute(connection -> connection.bZPopMax(rawKey, timeout, unit), true)); + return deserializeTuple(execute(connection -> connection.bZPopMax(rawKey, timeout, unit))); } /* @@ -615,7 +614,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Long zCard(K key) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.zCard(rawKey), true); + return execute(connection -> connection.zCard(rawKey)); } /* @@ -626,7 +625,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set difference(K key, Collection otherKeys) { byte[][] rawKeys = rawKeys(key, otherKeys); - Set rawValues = execute(connection -> connection.zDiff(rawKeys), true); + Set rawValues = execute(connection -> connection.zDiff(rawKeys)); return deserializeValues(rawValues); } @@ -638,7 +637,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set> differenceWithScores(K key, Collection otherKeys) { byte[][] rawKeys = rawKeys(key, otherKeys); - Set result = execute(connection -> connection.zDiffWithScores(rawKeys), true); + Set result = execute(connection -> connection.zDiffWithScores(rawKeys)); return deserializeTupleValues(new LinkedHashSet<>(result)); } @@ -652,7 +651,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS byte[][] rawKeys = rawKeys(key, otherKeys); byte[] rawDestKey = rawKey(destKey); - return execute(connection -> connection.zDiffStore(rawDestKey, rawKeys), true); + return execute(connection -> connection.zDiffStore(rawDestKey, rawKeys)); } /* @@ -663,7 +662,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set intersect(K key, Collection otherKeys) { byte[][] rawKeys = rawKeys(key, otherKeys); - Set rawValues = execute(connection -> connection.zInter(rawKeys), true); + Set rawValues = execute(connection -> connection.zInter(rawKeys)); return deserializeValues(rawValues); } @@ -675,7 +674,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set> intersectWithScores(K key, Collection otherKeys) { byte[][] rawKeys = rawKeys(key, otherKeys); - Set result = execute(connection -> connection.zInterWithScores(rawKeys), true); + Set result = execute(connection -> connection.zInterWithScores(rawKeys)); return deserializeTupleValues(result); } @@ -687,7 +686,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set> intersectWithScores(K key, Collection otherKeys, Aggregate aggregate, Weights weights) { byte[][] rawKeys = rawKeys(key, otherKeys); - Set result = execute(connection -> connection.zInterWithScores(aggregate, weights, rawKeys), true); + Set result = execute(connection -> connection.zInterWithScores(aggregate, weights, rawKeys)); return deserializeTupleValues(result); } @@ -710,7 +709,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS byte[][] rawKeys = rawKeys(key, otherKeys); byte[] rawDestKey = rawKey(destKey); - return execute(connection -> connection.zInterStore(rawDestKey, rawKeys), true); + return execute(connection -> connection.zInterStore(rawDestKey, rawKeys)); } /* @@ -723,7 +722,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS byte[][] rawKeys = rawKeys(key, otherKeys); byte[] rawDestKey = rawKey(destKey); - return execute(connection -> connection.zInterStore(rawDestKey, aggregate, weights, rawKeys), true); + return execute(connection -> connection.zInterStore(rawDestKey, aggregate, weights, rawKeys)); } /* @@ -734,7 +733,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set union(K key, Collection otherKeys) { byte[][] rawKeys = rawKeys(key, otherKeys); - Set rawValues = execute(connection -> connection.zUnion(rawKeys), true); + Set rawValues = execute(connection -> connection.zUnion(rawKeys)); return deserializeValues(rawValues); } @@ -746,7 +745,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set> unionWithScores(K key, Collection otherKeys) { byte[][] rawKeys = rawKeys(key, otherKeys); - Set result = execute(connection -> connection.zUnionWithScores(rawKeys), true); + Set result = execute(connection -> connection.zUnionWithScores(rawKeys)); return deserializeTupleValues(result); } @@ -758,7 +757,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set> unionWithScores(K key, Collection otherKeys, Aggregate aggregate, Weights weights) { byte[][] rawKeys = rawKeys(key, otherKeys); - Set result = execute(connection -> connection.zUnionWithScores(aggregate, weights, rawKeys), true); + Set result = execute(connection -> connection.zUnionWithScores(aggregate, weights, rawKeys)); return deserializeTupleValues( result); } @@ -782,7 +781,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS byte[][] rawKeys = rawKeys(key, otherKeys); byte[] rawDestKey = rawKey(destKey); - return execute(connection -> connection.zUnionStore(rawDestKey, rawKeys), true); + return execute(connection -> connection.zUnionStore(rawDestKey, rawKeys)); } /* @@ -795,7 +794,7 @@ class DefaultZSetOperations extends AbstractOperations implements ZS byte[][] rawKeys = rawKeys(key, otherKeys); byte[] rawDestKey = rawKey(destKey); - return execute(connection -> connection.zUnionStore(rawDestKey, aggregate, weights, rawKeys), true); + return execute(connection -> connection.zUnionStore(rawDestKey, aggregate, weights, rawKeys)); } /* @@ -814,14 +813,14 @@ class DefaultZSetOperations extends AbstractOperations implements ZS public Set rangeByScore(K key, String min, String max) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.zRangeByScore(rawKey, min, max), true); + return execute(connection -> connection.zRangeByScore(rawKey, min, max)); } public Set rangeByScore(K key, String min, String max, long offset, long count) { byte[] rawKey = rawKey(key); - return execute(connection -> connection.zRangeByScore(rawKey, min, max, offset, count), true); + return execute(connection -> connection.zRangeByScore(rawKey, min, max, offset, count)); } }