DATAREDIS-719 - Use asynchronous Lettuce API for transactions.
We now use the asynchronous API to dispatch commands within a transaction using the Lettuce driver. This allows us dropping our additional result wrappers and use a single, uniform api for deferred results. Original pull request: #289.
This commit is contained in:
@@ -66,6 +66,7 @@ import org.springframework.data.redis.connection.*;
|
||||
import org.springframework.data.redis.connection.convert.TransactionResultConverter;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionProvider.TargetAware;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceResult.LettuceResultBuilder;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceResult.LettuceStatusResult;
|
||||
import org.springframework.data.redis.core.RedisCommand;
|
||||
import org.springframework.data.redis.core.ScanOptions;
|
||||
import org.springframework.lang.Nullable;
|
||||
@@ -135,29 +136,6 @@ public class LettuceConnection extends AbstractRedisConnection {
|
||||
return LettuceResultBuilder.<T, R> forResponse(resultHolder).buildStatusResult();
|
||||
}
|
||||
|
||||
<T> LettuceTxResult<T, Object> newLettuceTxResult(T resultHolder) {
|
||||
return newLettuceTxResult(resultHolder, (val) -> val);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
<T> LettuceTxResult<T, Object> newLettuceTxResult(T resultHolder, Converter<T, ?> converter) {
|
||||
|
||||
return LettuceResultBuilder.forResponse(resultHolder).mappedWith((Converter) converter)
|
||||
.convertPipelineAndTxResults(convertPipelineAndTxResults).buildTxResult();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
<T> LettuceTxResult<T, Object> newLettuceTxResult(T resultHolder, Converter<T, ?> converter,
|
||||
Supplier<?> defaultValue) {
|
||||
|
||||
return LettuceResultBuilder.forResponse(resultHolder).mappedWith((Converter) converter)
|
||||
.convertPipelineAndTxResults(convertPipelineAndTxResults).defaultNullTo(defaultValue).buildTxResult();
|
||||
}
|
||||
|
||||
LettuceTxStatusResult newLettuceTxStatusResult(Object resultHolder) {
|
||||
return new LettuceTxStatusResult(resultHolder);
|
||||
}
|
||||
|
||||
private class LettuceTransactionResultConverter<T> extends TransactionResultConverter<T> {
|
||||
public LettuceTransactionResultConverter(Queue<FutureResult<T>> txResults,
|
||||
Converter<Exception, DataAccessException> exceptionConverter) {
|
||||
@@ -425,7 +403,7 @@ public class LettuceConnection extends AbstractRedisConnection {
|
||||
|
||||
if (isQueueing()) {
|
||||
|
||||
transaction(newLettuceTxResult(connectionImpl.dispatch(cmd.getType(), cmd.getOutput(), cmd.getArgs())));
|
||||
transaction(newLettuceResult(connectionImpl.dispatch(cmd.getType(), cmd.getOutput(), cmd.getArgs())));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -566,7 +544,7 @@ public class LettuceConnection extends AbstractRedisConnection {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(new LettuceTxResult<>(getConnection().echo(message)));
|
||||
transaction(newLettuceResult(getAsyncConnection().echo(message)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().echo(message);
|
||||
@@ -583,7 +561,7 @@ public class LettuceConnection extends AbstractRedisConnection {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(new LettuceTxResult<>(getConnection().ping()));
|
||||
transaction(newLettuceResult(getAsyncConnection().ping()));
|
||||
return null;
|
||||
}
|
||||
return getConnection().ping();
|
||||
@@ -646,10 +624,10 @@ public class LettuceConnection extends AbstractRedisConnection {
|
||||
isMulti = true;
|
||||
try {
|
||||
if (isPipelined()) {
|
||||
((RedisAsyncCommands) getAsyncDedicatedConnection()).multi();
|
||||
getAsyncDedicatedRedisCommands().multi();
|
||||
return;
|
||||
}
|
||||
(getDedicatedRedisCommands()).multi();
|
||||
getDedicatedRedisCommands().multi();
|
||||
} catch (Exception ex) {
|
||||
throw convertLettuceAccessException(ex);
|
||||
}
|
||||
@@ -662,14 +640,20 @@ public class LettuceConnection extends AbstractRedisConnection {
|
||||
throw new UnsupportedOperationException("Selecting a new database not supported due to shared connection. "
|
||||
+ "Use separate ConnectionFactorys to work with multiple databases");
|
||||
}
|
||||
if (isPipelined()) {
|
||||
throw new UnsupportedOperationException("Lettuce blocks for #select");
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
this.dbIndex = dbIndex;
|
||||
|
||||
if (isPipelined()) {
|
||||
pipeline(new LettuceStatusResult(getAsyncConnection().dispatch(CommandType.SELECT,
|
||||
new StatusOutput<>(ByteArrayCodec.INSTANCE), new CommandArgs<>(ByteArrayCodec.INSTANCE).add(dbIndex))));
|
||||
return;
|
||||
}
|
||||
|
||||
if (isQueueing()) {
|
||||
transaction(newLettuceStatusResult(((RedisCommands)getAsyncConnection()).select(dbIndex)));
|
||||
transaction(newLettuceStatusResult(getAsyncConnection().dispatch(CommandType.SELECT,
|
||||
new StatusOutput<>(ByteArrayCodec.INSTANCE), new CommandArgs<>(ByteArrayCodec.INSTANCE).add(dbIndex))));
|
||||
return;
|
||||
}
|
||||
((RedisCommands) getConnection()).select(dbIndex);
|
||||
@@ -682,11 +666,11 @@ public class LettuceConnection extends AbstractRedisConnection {
|
||||
public void unwatch() {
|
||||
try {
|
||||
if (isPipelined()) {
|
||||
pipeline(newLettuceStatusResult(((RedisAsyncCommands) getAsyncDedicatedConnection()).unwatch()));
|
||||
pipeline(newLettuceStatusResult(getAsyncDedicatedRedisCommands().unwatch()));
|
||||
return;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(newLettuceStatusResult(getDedicatedRedisCommands().unwatch()));
|
||||
transaction(newLettuceStatusResult(getAsyncDedicatedRedisCommands().unwatch()));
|
||||
return;
|
||||
}
|
||||
getDedicatedRedisCommands().unwatch();
|
||||
@@ -706,7 +690,7 @@ public class LettuceConnection extends AbstractRedisConnection {
|
||||
return;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(new LettuceTxStatusResult(getDedicatedRedisCommands().watch(keys)));
|
||||
transaction(new LettuceStatusResult(getAsyncDedicatedRedisCommands().watch(keys)));
|
||||
return;
|
||||
}
|
||||
getDedicatedRedisCommands().watch(keys);
|
||||
@@ -727,7 +711,7 @@ public class LettuceConnection extends AbstractRedisConnection {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(newLettuceTxResult(getConnection().publish(channel, message)));
|
||||
transaction(newLettuceResult(getAsyncConnection().publish(channel, message)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().publish(channel, message);
|
||||
|
||||
@@ -40,7 +40,6 @@ import org.springframework.data.geo.Metric;
|
||||
import org.springframework.data.geo.Point;
|
||||
import org.springframework.data.redis.connection.RedisGeoCommands;
|
||||
import org.springframework.data.redis.connection.convert.ListConverter;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceResult.LettuceTxResult;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -71,7 +70,7 @@ class LettuceGeoCommands implements RedisGeoCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().geoadd(key, point.getX(), point.getY(), member)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().geoadd(key, point.getX(), point.getY(), member)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().geoadd(key, point.getX(), point.getY(), member);
|
||||
@@ -132,7 +131,7 @@ class LettuceGeoCommands implements RedisGeoCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().geoadd(key, values.toArray())));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().geoadd(key, values.toArray())));
|
||||
return null;
|
||||
}
|
||||
return getConnection().geoadd(key, values.toArray());
|
||||
@@ -172,8 +171,8 @@ class LettuceGeoCommands implements RedisGeoCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(
|
||||
connection.newLettuceTxResult(getConnection().geodist(key, member1, member2, geoUnit), distanceConverter));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().geodist(key, member1, member2, geoUnit),
|
||||
distanceConverter));
|
||||
return null;
|
||||
}
|
||||
return distanceConverter.convert(getConnection().geodist(key, member1, member2, geoUnit));
|
||||
@@ -199,7 +198,7 @@ class LettuceGeoCommands implements RedisGeoCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().geohash(key, members)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().geohash(key, members)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().geohash(key, members).stream().map(value -> value.getValueOrElse(null))
|
||||
@@ -228,7 +227,7 @@ class LettuceGeoCommands implements RedisGeoCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().geopos(key, members), converter));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().geopos(key, members), converter));
|
||||
return null;
|
||||
}
|
||||
return converter.convert(getConnection().geopos(key, members));
|
||||
@@ -259,8 +258,8 @@ class LettuceGeoCommands implements RedisGeoCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(
|
||||
getConnection().georadius(key, within.getCenter().getX(), within.getCenter().getY(),
|
||||
transaction(connection.newLettuceResult(
|
||||
getAsyncConnection().georadius(key, within.getCenter().getX(), within.getCenter().getY(),
|
||||
within.getRadius().getValue(), LettuceConverters.toGeoArgsUnit(within.getRadius().getMetric())),
|
||||
geoResultsConverter));
|
||||
return null;
|
||||
@@ -296,7 +295,7 @@ class LettuceGeoCommands implements RedisGeoCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().georadius(key, within.getCenter().getX(),
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().georadius(key, within.getCenter().getX(),
|
||||
within.getCenter().getY(), within.getRadius().getValue(),
|
||||
LettuceConverters.toGeoArgsUnit(within.getRadius().getMetric()), geoArgs), geoResultsConverter));
|
||||
return null;
|
||||
@@ -340,8 +339,8 @@ class LettuceGeoCommands implements RedisGeoCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection
|
||||
.newLettuceTxResult(getConnection().georadiusbymember(key, member, radius.getValue(), geoUnit), converter));
|
||||
transaction(connection.newLettuceResult(
|
||||
getAsyncConnection().georadiusbymember(key, member, radius.getValue(), geoUnit), converter));
|
||||
return null;
|
||||
}
|
||||
return converter.convert(getConnection().georadiusbymember(key, member, radius.getValue(), geoUnit));
|
||||
@@ -376,8 +375,9 @@ class LettuceGeoCommands implements RedisGeoCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(
|
||||
getConnection().georadiusbymember(key, member, radius.getValue(), geoUnit, geoArgs), geoResultsConverter));
|
||||
transaction(connection.newLettuceResult(
|
||||
getAsyncConnection().georadiusbymember(key, member, radius.getValue(), geoUnit, geoArgs),
|
||||
geoResultsConverter));
|
||||
return null;
|
||||
}
|
||||
return geoResultsConverter
|
||||
@@ -408,7 +408,7 @@ class LettuceGeoCommands implements RedisGeoCommands {
|
||||
connection.pipeline(result);
|
||||
}
|
||||
|
||||
private void transaction(LettuceTxResult result) {
|
||||
private void transaction(LettuceResult result) {
|
||||
connection.transaction(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ import java.util.Set;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.data.redis.connection.RedisHashCommands;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceResult.LettuceTxResult;
|
||||
import org.springframework.data.redis.core.Cursor;
|
||||
import org.springframework.data.redis.core.KeyBoundCursor;
|
||||
import org.springframework.data.redis.core.ScanIteration;
|
||||
@@ -64,7 +63,7 @@ class LettuceHashCommands implements RedisHashCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().hset(key, field, value)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().hset(key, field, value)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().hset(key, field, value);
|
||||
@@ -90,7 +89,7 @@ class LettuceHashCommands implements RedisHashCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().hsetnx(key, field, value)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().hsetnx(key, field, value)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().hsetnx(key, field, value);
|
||||
@@ -115,7 +114,7 @@ class LettuceHashCommands implements RedisHashCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().hdel(key, fields)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().hdel(key, fields)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().hdel(key, fields);
|
||||
@@ -140,7 +139,7 @@ class LettuceHashCommands implements RedisHashCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().hexists(key, field)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().hexists(key, field)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().hexists(key, field);
|
||||
@@ -165,7 +164,7 @@ class LettuceHashCommands implements RedisHashCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().hget(key, field)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().hget(key, field)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().hget(key, field);
|
||||
@@ -189,7 +188,7 @@ class LettuceHashCommands implements RedisHashCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().hgetall(key)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().hgetall(key)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().hgetall(key);
|
||||
@@ -214,7 +213,7 @@ class LettuceHashCommands implements RedisHashCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().hincrby(key, field, delta)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().hincrby(key, field, delta)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().hincrby(key, field, delta);
|
||||
@@ -239,7 +238,7 @@ class LettuceHashCommands implements RedisHashCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().hincrbyfloat(key, field, delta)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().hincrbyfloat(key, field, delta)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().hincrbyfloat(key, field, delta);
|
||||
@@ -263,7 +262,8 @@ class LettuceHashCommands implements RedisHashCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().hkeys(key), LettuceConverters.bytesListToBytesSet()));
|
||||
transaction(
|
||||
connection.newLettuceResult(getAsyncConnection().hkeys(key), LettuceConverters.bytesListToBytesSet()));
|
||||
return null;
|
||||
}
|
||||
return LettuceConverters.toBytesSet(getConnection().hkeys(key));
|
||||
@@ -287,7 +287,7 @@ class LettuceHashCommands implements RedisHashCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().hlen(key)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().hlen(key)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().hlen(key);
|
||||
@@ -313,7 +313,7 @@ class LettuceHashCommands implements RedisHashCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().hmget(key, fields),
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().hmget(key, fields),
|
||||
LettuceConverters.keyValueListUnwrapper()));
|
||||
return null;
|
||||
}
|
||||
@@ -339,7 +339,7 @@ class LettuceHashCommands implements RedisHashCommands {
|
||||
return;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxStatusResult(getConnection().hmset(key, hashes)));
|
||||
transaction(connection.newLettuceStatusResult(getAsyncConnection().hmset(key, hashes)));
|
||||
return;
|
||||
}
|
||||
getConnection().hmset(key, hashes);
|
||||
@@ -363,7 +363,7 @@ class LettuceHashCommands implements RedisHashCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().hvals(key)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().hvals(key)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().hvals(key);
|
||||
@@ -434,7 +434,7 @@ class LettuceHashCommands implements RedisHashCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().hstrlen(key, field)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().hstrlen(key, field)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().hstrlen(key, field);
|
||||
@@ -455,7 +455,7 @@ class LettuceHashCommands implements RedisHashCommands {
|
||||
connection.pipeline(result);
|
||||
}
|
||||
|
||||
private void transaction(LettuceTxResult result) {
|
||||
private void transaction(LettuceResult result) {
|
||||
connection.transaction(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import io.lettuce.core.api.async.RedisHLLAsyncCommands;
|
||||
import io.lettuce.core.api.sync.RedisHLLCommands;
|
||||
import io.lettuce.core.cluster.api.async.RedisClusterAsyncCommands;
|
||||
import io.lettuce.core.cluster.api.sync.RedisClusterCommands;
|
||||
@@ -24,7 +23,6 @@ import lombok.RequiredArgsConstructor;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.data.redis.connection.RedisHyperLogLogCommands;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceResult.LettuceTxResult;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -49,14 +47,12 @@ class LettuceHyperLogLogCommands implements RedisHyperLogLogCommands {
|
||||
|
||||
try {
|
||||
if (isPipelined()) {
|
||||
RedisHLLAsyncCommands<byte[], byte[]> asyncConnection = getAsyncConnection();
|
||||
pipeline(connection.newLettuceResult(asyncConnection.pfadd(key, values)));
|
||||
pipeline(connection.newLettuceResult(getAsyncConnection().pfadd(key, values)));
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isQueueing()) {
|
||||
RedisHLLAsyncCommands<byte[], byte[]> asyncConnection = getAsyncConnection();
|
||||
transaction(connection.newLettuceTxResult(asyncConnection.pfadd(key, values)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().pfadd(key, values)));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -79,14 +75,12 @@ class LettuceHyperLogLogCommands implements RedisHyperLogLogCommands {
|
||||
|
||||
try {
|
||||
if (isPipelined()) {
|
||||
RedisHLLAsyncCommands<byte[], byte[]> asyncConnection = getAsyncConnection();
|
||||
pipeline(connection.newLettuceResult(asyncConnection.pfcount(keys)));
|
||||
pipeline(connection.newLettuceResult(getAsyncConnection().pfcount(keys)));
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isQueueing()) {
|
||||
RedisHLLAsyncCommands<byte[], byte[]> asyncConnection = getAsyncConnection();
|
||||
transaction(connection.newLettuceTxResult(asyncConnection.pfcount(keys)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().pfcount(keys)));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -110,14 +104,12 @@ class LettuceHyperLogLogCommands implements RedisHyperLogLogCommands {
|
||||
|
||||
try {
|
||||
if (isPipelined()) {
|
||||
RedisHLLAsyncCommands<byte[], byte[]> asyncConnection = getAsyncConnection();
|
||||
pipeline(connection.newLettuceResult(asyncConnection.pfmerge(destinationKey, sourceKeys)));
|
||||
pipeline(connection.newLettuceResult(getAsyncConnection().pfmerge(destinationKey, sourceKeys)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (isQueueing()) {
|
||||
RedisHLLAsyncCommands<byte[], byte[]> asyncConnection = getAsyncConnection();
|
||||
transaction(connection.newLettuceTxResult(asyncConnection.pfmerge(destinationKey, sourceKeys)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().pfmerge(destinationKey, sourceKeys)));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -140,7 +132,7 @@ class LettuceHyperLogLogCommands implements RedisHyperLogLogCommands {
|
||||
connection.pipeline(result);
|
||||
}
|
||||
|
||||
private void transaction(LettuceTxResult result) {
|
||||
private void transaction(LettuceResult result) {
|
||||
connection.transaction(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ import org.springframework.data.redis.connection.DataType;
|
||||
import org.springframework.data.redis.connection.RedisKeyCommands;
|
||||
import org.springframework.data.redis.connection.SortParameters;
|
||||
import org.springframework.data.redis.connection.convert.Converters;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceResult.LettuceTxResult;
|
||||
import org.springframework.data.redis.core.Cursor;
|
||||
import org.springframework.data.redis.core.ScanCursor;
|
||||
import org.springframework.data.redis.core.ScanIteration;
|
||||
@@ -66,7 +65,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().exists(new byte[][] { key }),
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().exists(new byte[][] { key }),
|
||||
LettuceConverters.longToBooleanConverter()));
|
||||
return null;
|
||||
}
|
||||
@@ -93,7 +92,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().exists(keys)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().exists(keys)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().exists(keys);
|
||||
@@ -118,7 +117,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().del(keys)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().del(keys)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().del(keys);
|
||||
@@ -142,7 +141,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().type(key), LettuceConverters.stringToDataType()));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().type(key), LettuceConverters.stringToDataType()));
|
||||
return null;
|
||||
}
|
||||
return LettuceConverters.toDataType(getConnection().type(key));
|
||||
@@ -168,7 +167,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(
|
||||
connection.newLettuceTxResult(getConnection().keys(pattern), LettuceConverters.bytesListToBytesSet()));
|
||||
connection.newLettuceResult(getAsyncConnection().keys(pattern), LettuceConverters.bytesListToBytesSet()));
|
||||
return null;
|
||||
}
|
||||
return LettuceConverters.toBytesSet(getConnection().keys(pattern));
|
||||
@@ -244,7 +243,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().randomkey()));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().randomkey()));
|
||||
return null;
|
||||
}
|
||||
return getConnection().randomkey();
|
||||
@@ -269,7 +268,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
return;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxStatusResult(getConnection().rename(sourceKey, targetKey)));
|
||||
transaction(connection.newLettuceStatusResult(getAsyncConnection().rename(sourceKey, targetKey)));
|
||||
return;
|
||||
}
|
||||
getConnection().rename(sourceKey, targetKey);
|
||||
@@ -294,7 +293,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().renamenx(sourceKey, targetKey)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().renamenx(sourceKey, targetKey)));
|
||||
return null;
|
||||
}
|
||||
return (getConnection().renamenx(sourceKey, targetKey));
|
||||
@@ -318,7 +317,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().expire(key, seconds)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().expire(key, seconds)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().expire(key, seconds);
|
||||
@@ -342,7 +341,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().pexpire(key, millis)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().pexpire(key, millis)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().pexpire(key, millis);
|
||||
@@ -366,7 +365,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().expireat(key, unixTime)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().expireat(key, unixTime)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().expireat(key, unixTime);
|
||||
@@ -390,7 +389,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().pexpireat(key, unixTimeInMillis)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().pexpireat(key, unixTimeInMillis)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().pexpireat(key, unixTimeInMillis);
|
||||
@@ -414,7 +413,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().persist(key)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().persist(key)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().persist(key);
|
||||
@@ -438,7 +437,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().move(key, dbIndex)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().move(key, dbIndex)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().move(key, dbIndex);
|
||||
@@ -462,7 +461,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().ttl(key)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().ttl(key)));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -487,7 +486,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().ttl(key), Converters.secondsToTimeUnit(timeUnit)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().ttl(key), Converters.secondsToTimeUnit(timeUnit)));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -512,7 +511,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().pttl(key)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().pttl(key)));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -539,7 +538,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(
|
||||
connection.newLettuceTxResult(getConnection().pttl(key), Converters.millisecondsToTimeUnit(timeUnit)));
|
||||
connection.newLettuceResult(getAsyncConnection().pttl(key), Converters.millisecondsToTimeUnit(timeUnit)));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -566,7 +565,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().sort(key, args)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().sort(key, args)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().sort(key, args);
|
||||
@@ -592,7 +591,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().sortStore(key, args, sortKey)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().sortStore(key, args, sortKey)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().sortStore(key, args, sortKey);
|
||||
@@ -616,7 +615,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().dump(key)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().dump(key)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().dump(key);
|
||||
@@ -641,7 +640,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
return;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxStatusResult(getConnection().restore(key, ttlInMillis, serializedValue)));
|
||||
transaction(connection.newLettuceStatusResult(getAsyncConnection().restore(key, ttlInMillis, serializedValue)));
|
||||
return;
|
||||
}
|
||||
getConnection().restore(key, ttlInMillis, serializedValue);
|
||||
@@ -662,7 +661,7 @@ class LettuceKeyCommands implements RedisKeyCommands {
|
||||
connection.pipeline(result);
|
||||
}
|
||||
|
||||
private void transaction(LettuceTxResult result) {
|
||||
private void transaction(LettuceResult result) {
|
||||
connection.transaction(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.util.List;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.data.redis.connection.RedisListCommands;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceResult.LettuceTxResult;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -52,7 +51,7 @@ class LettuceListCommands implements RedisListCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().rpush(key, values)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().rpush(key, values)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().rpush(key, values);
|
||||
@@ -78,7 +77,7 @@ class LettuceListCommands implements RedisListCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().lpush(key, values)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().lpush(key, values)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().lpush(key, values);
|
||||
@@ -103,7 +102,7 @@ class LettuceListCommands implements RedisListCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().rpushx(key, value)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().rpushx(key, value)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().rpushx(key, value);
|
||||
@@ -128,7 +127,7 @@ class LettuceListCommands implements RedisListCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().lpushx(key, value)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().lpushx(key, value)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().lpushx(key, value);
|
||||
@@ -152,7 +151,7 @@ class LettuceListCommands implements RedisListCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().llen(key)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().llen(key)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().llen(key);
|
||||
@@ -176,7 +175,7 @@ class LettuceListCommands implements RedisListCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().lrange(key, start, end)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().lrange(key, start, end)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().lrange(key, start, end);
|
||||
@@ -200,7 +199,7 @@ class LettuceListCommands implements RedisListCommands {
|
||||
return;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxStatusResult(getConnection().ltrim(key, start, end)));
|
||||
transaction(connection.newLettuceStatusResult(getAsyncConnection().ltrim(key, start, end)));
|
||||
return;
|
||||
}
|
||||
getConnection().ltrim(key, start, end);
|
||||
@@ -224,7 +223,7 @@ class LettuceListCommands implements RedisListCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().lindex(key, index)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().lindex(key, index)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().lindex(key, index);
|
||||
@@ -250,7 +249,7 @@ class LettuceListCommands implements RedisListCommands {
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection
|
||||
.newLettuceTxResult(getConnection().linsert(key, LettuceConverters.toBoolean(where), pivot, value)));
|
||||
.newLettuceResult(getAsyncConnection().linsert(key, LettuceConverters.toBoolean(where), pivot, value)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().linsert(key, LettuceConverters.toBoolean(where), pivot, value);
|
||||
@@ -275,7 +274,7 @@ class LettuceListCommands implements RedisListCommands {
|
||||
return;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxStatusResult(getConnection().lset(key, index, value)));
|
||||
transaction(connection.newLettuceStatusResult(getAsyncConnection().lset(key, index, value)));
|
||||
return;
|
||||
}
|
||||
getConnection().lset(key, index, value);
|
||||
@@ -300,7 +299,7 @@ class LettuceListCommands implements RedisListCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().lrem(key, count, value)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().lrem(key, count, value)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().lrem(key, count, value);
|
||||
@@ -324,7 +323,7 @@ class LettuceListCommands implements RedisListCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().lpop(key)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().lpop(key)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().lpop(key);
|
||||
@@ -348,7 +347,7 @@ class LettuceListCommands implements RedisListCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().rpop(key)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().rpop(key)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().rpop(key);
|
||||
@@ -374,7 +373,7 @@ class LettuceListCommands implements RedisListCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(connection.getDedicatedConnection().blpop(timeout, keys),
|
||||
transaction(connection.newLettuceResult(connection.getAsyncDedicatedConnection().blpop(timeout, keys),
|
||||
LettuceConverters.keyValueToBytesList()));
|
||||
return null;
|
||||
}
|
||||
@@ -401,7 +400,7 @@ class LettuceListCommands implements RedisListCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(connection.getDedicatedConnection().brpop(timeout, keys),
|
||||
transaction(connection.newLettuceResult(connection.getAsyncDedicatedConnection().brpop(timeout, keys),
|
||||
LettuceConverters.keyValueToBytesList()));
|
||||
return null;
|
||||
}
|
||||
@@ -427,7 +426,7 @@ class LettuceListCommands implements RedisListCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().rpoplpush(srcKey, dstKey)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().rpoplpush(srcKey, dstKey)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().rpoplpush(srcKey, dstKey);
|
||||
@@ -454,7 +453,7 @@ class LettuceListCommands implements RedisListCommands {
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(
|
||||
connection.newLettuceTxResult(connection.getDedicatedConnection().brpoplpush(timeout, srcKey, dstKey)));
|
||||
connection.newLettuceResult(connection.getAsyncDedicatedConnection().brpoplpush(timeout, srcKey, dstKey)));
|
||||
return null;
|
||||
}
|
||||
return connection.getDedicatedConnection().brpoplpush(timeout, srcKey, dstKey);
|
||||
@@ -475,7 +474,7 @@ class LettuceListCommands implements RedisListCommands {
|
||||
connection.pipeline(result);
|
||||
}
|
||||
|
||||
private void transaction(LettuceTxResult result) {
|
||||
private void transaction(LettuceResult result) {
|
||||
connection.transaction(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,17 +38,18 @@ class LettuceResult<T, R> extends FutureResult<RedisCommand<?, T, ?>> {
|
||||
|
||||
private final boolean convertPipelineAndTxResults;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
LettuceResult(Future<T> resultHolder) {
|
||||
this(resultHolder, false, val -> val);
|
||||
this(resultHolder, false, (Converter) val -> val);
|
||||
}
|
||||
|
||||
LettuceResult(Future<T> resultHolder, boolean convertPipelineAndTxResults, @Nullable Converter<T, ?> converter) {
|
||||
LettuceResult(Future<T> resultHolder, boolean convertPipelineAndTxResults, @Nullable Converter<T, R> converter) {
|
||||
this(resultHolder, () -> null, convertPipelineAndTxResults, converter);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
LettuceResult(Future<T> resultHolder, Supplier<R> defaultReturnValue, boolean convertPipelineAndTxResults,
|
||||
@Nullable Converter<T, ?> converter) {
|
||||
@Nullable Converter<T, R> converter) {
|
||||
|
||||
super((RedisCommand) resultHolder, converter, defaultReturnValue);
|
||||
this.convertPipelineAndTxResults = convertPipelineAndTxResults;
|
||||
@@ -86,50 +87,6 @@ class LettuceResult<T, R> extends FutureResult<RedisCommand<?, T, ?>> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lettuce specific {@link FutureResult} implementation of a transaction result.
|
||||
*/
|
||||
static class LettuceTxResult<T, R> extends FutureResult<T> {
|
||||
|
||||
private final boolean convertPipelineAndTxResults;
|
||||
|
||||
LettuceTxResult(T resultHolder) {
|
||||
this(resultHolder, false, val -> (R) val);
|
||||
}
|
||||
|
||||
LettuceTxResult(T resultHolder, boolean convertPipelineAndTxResults, Converter<T, R> converter) {
|
||||
this(resultHolder, () -> null, convertPipelineAndTxResults, converter);
|
||||
}
|
||||
|
||||
LettuceTxResult(T resultHolder, Supplier<Object> defaultReturnValue, boolean convertPipelineAndTxResults,
|
||||
Converter<T, R> converter) {
|
||||
super(resultHolder, converter, defaultReturnValue);
|
||||
this.convertPipelineAndTxResults = convertPipelineAndTxResults;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Object get() {
|
||||
return getResultHolder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean seeksConversion() {
|
||||
return convertPipelineAndTxResults;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lettuce specific {@link FutureResult} implementation of a throw away status result.
|
||||
*/
|
||||
static class LettuceTxStatusResult extends LettuceTxResult<Object, Object> {
|
||||
|
||||
LettuceTxStatusResult(Object resultHolder) {
|
||||
super(resultHolder);
|
||||
setStatus(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder for constructing {@link LettuceResult}.
|
||||
*
|
||||
@@ -144,6 +101,7 @@ class LettuceResult<T, R> extends FutureResult<RedisCommand<?, T, ?>> {
|
||||
private boolean convertPipelineAndTxResults = false;
|
||||
private Supplier<R> nullValueDefault = () -> null;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
LettuceResultBuilder(Future<T> response) {
|
||||
|
||||
this.response = response;
|
||||
@@ -171,7 +129,7 @@ class LettuceResult<T, R> extends FutureResult<RedisCommand<?, T, ?>> {
|
||||
LettuceResultBuilder<T, R> mappedWith(Converter<T, R> converter) {
|
||||
|
||||
this.converter = converter;
|
||||
return (LettuceResultBuilder<T, R>) this;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.data.redis.connection.RedisScriptingCommands;
|
||||
import org.springframework.data.redis.connection.ReturnType;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceResult.LettuceTxResult;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -53,7 +52,7 @@ class LettuceScriptingCommands implements RedisScriptingCommands {
|
||||
return;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxStatusResult(getConnection().scriptFlush()));
|
||||
transaction(connection.newLettuceStatusResult(getAsyncConnection().scriptFlush()));
|
||||
return;
|
||||
}
|
||||
getConnection().scriptFlush();
|
||||
@@ -99,7 +98,7 @@ class LettuceScriptingCommands implements RedisScriptingCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().scriptLoad(script)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().scriptLoad(script)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().scriptLoad(script);
|
||||
@@ -124,7 +123,7 @@ class LettuceScriptingCommands implements RedisScriptingCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().scriptExists(scriptSha1)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().scriptExists(scriptSha1)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().scriptExists(scriptSha1);
|
||||
@@ -153,8 +152,8 @@ class LettuceScriptingCommands implements RedisScriptingCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(
|
||||
getConnection().eval(convertedScript, LettuceConverters.toScriptOutputType(returnType), keys, args),
|
||||
transaction(connection.newLettuceResult(
|
||||
getAsyncConnection().eval(convertedScript, LettuceConverters.toScriptOutputType(returnType), keys, args),
|
||||
new LettuceEvalResultsConverter<T>(returnType)));
|
||||
return null;
|
||||
}
|
||||
@@ -185,8 +184,8 @@ class LettuceScriptingCommands implements RedisScriptingCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(
|
||||
getConnection().evalsha(scriptSha1, LettuceConverters.toScriptOutputType(returnType), keys, args),
|
||||
transaction(connection.newLettuceResult(
|
||||
getAsyncConnection().evalsha(scriptSha1, LettuceConverters.toScriptOutputType(returnType), keys, args),
|
||||
new LettuceEvalResultsConverter<T>(returnType)));
|
||||
return null;
|
||||
}
|
||||
@@ -221,7 +220,7 @@ class LettuceScriptingCommands implements RedisScriptingCommands {
|
||||
connection.pipeline(result);
|
||||
}
|
||||
|
||||
private void transaction(LettuceTxResult result) {
|
||||
private void transaction(LettuceResult result) {
|
||||
connection.transaction(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.data.redis.connection.RedisNode;
|
||||
import org.springframework.data.redis.connection.RedisServerCommands;
|
||||
import org.springframework.data.redis.connection.convert.Converters;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceResult.LettuceTxResult;
|
||||
import org.springframework.data.redis.core.types.RedisClientInfo;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -54,7 +53,7 @@ class LettuceServerCommands implements RedisServerCommands {
|
||||
return;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxStatusResult(getConnection().bgrewriteaof()));
|
||||
transaction(connection.newLettuceStatusResult(getAsyncConnection().bgrewriteaof()));
|
||||
return;
|
||||
}
|
||||
getConnection().bgrewriteaof();
|
||||
@@ -76,7 +75,7 @@ class LettuceServerCommands implements RedisServerCommands {
|
||||
return;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxStatusResult(getConnection().bgsave()));
|
||||
transaction(connection.newLettuceStatusResult(getAsyncConnection().bgsave()));
|
||||
return;
|
||||
}
|
||||
getConnection().bgsave();
|
||||
@@ -98,7 +97,7 @@ class LettuceServerCommands implements RedisServerCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().lastsave(), LettuceConverters.dateToLong()));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().lastsave(), LettuceConverters.dateToLong()));
|
||||
return null;
|
||||
}
|
||||
return LettuceConverters.toLong(getConnection().lastsave());
|
||||
@@ -120,7 +119,7 @@ class LettuceServerCommands implements RedisServerCommands {
|
||||
return;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxStatusResult(getConnection().save()));
|
||||
transaction(connection.newLettuceStatusResult(getAsyncConnection().save()));
|
||||
return;
|
||||
}
|
||||
getConnection().save();
|
||||
@@ -142,7 +141,7 @@ class LettuceServerCommands implements RedisServerCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().dbsize()));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().dbsize()));
|
||||
return null;
|
||||
}
|
||||
return getConnection().dbsize();
|
||||
@@ -164,7 +163,7 @@ class LettuceServerCommands implements RedisServerCommands {
|
||||
return;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxStatusResult(getConnection().flushdb()));
|
||||
transaction(connection.newLettuceStatusResult(getAsyncConnection().flushdb()));
|
||||
return;
|
||||
}
|
||||
getConnection().flushdb();
|
||||
@@ -186,7 +185,7 @@ class LettuceServerCommands implements RedisServerCommands {
|
||||
return;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().flushall()));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().flushall()));
|
||||
return;
|
||||
}
|
||||
getConnection().flushall();
|
||||
@@ -208,7 +207,7 @@ class LettuceServerCommands implements RedisServerCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().info(), LettuceConverters.stringToProps()));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().info(), LettuceConverters.stringToProps()));
|
||||
return null;
|
||||
}
|
||||
return LettuceConverters.toProperties(getConnection().info());
|
||||
@@ -232,7 +231,7 @@ class LettuceServerCommands implements RedisServerCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().info(section), LettuceConverters.stringToProps()));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().info(section), LettuceConverters.stringToProps()));
|
||||
return null;
|
||||
}
|
||||
return LettuceConverters.toProperties(getConnection().info(section));
|
||||
@@ -299,8 +298,8 @@ class LettuceServerCommands implements RedisServerCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(
|
||||
connection.newLettuceTxResult(getConnection().configGet(pattern), Converters.mapToPropertiesConverter()));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().configGet(pattern),
|
||||
Converters.mapToPropertiesConverter()));
|
||||
return null;
|
||||
}
|
||||
return Converters.toProperties(getConnection().configGet(pattern));
|
||||
@@ -325,7 +324,7 @@ class LettuceServerCommands implements RedisServerCommands {
|
||||
return;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxStatusResult(getConnection().configSet(param, value)));
|
||||
transaction(connection.newLettuceStatusResult(getAsyncConnection().configSet(param, value)));
|
||||
return;
|
||||
}
|
||||
getConnection().configSet(param, value);
|
||||
@@ -347,7 +346,7 @@ class LettuceServerCommands implements RedisServerCommands {
|
||||
return;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxStatusResult(getConnection().configResetstat()));
|
||||
transaction(connection.newLettuceStatusResult(getAsyncConnection().configResetstat()));
|
||||
return;
|
||||
}
|
||||
getConnection().configResetstat();
|
||||
@@ -369,7 +368,7 @@ class LettuceServerCommands implements RedisServerCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().time(), LettuceConverters.toTimeConverter()));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().time(), LettuceConverters.toTimeConverter()));
|
||||
return null;
|
||||
}
|
||||
return LettuceConverters.toTimeConverter().convert(getConnection().time());
|
||||
@@ -413,7 +412,7 @@ class LettuceServerCommands implements RedisServerCommands {
|
||||
return;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxStatusResult(getConnection().clientSetname(name)));
|
||||
transaction(connection.newLettuceStatusResult(getAsyncConnection().clientSetname(name)));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -433,7 +432,8 @@ class LettuceServerCommands implements RedisServerCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().clientGetname(), LettuceConverters.bytesToString()));
|
||||
transaction(
|
||||
connection.newLettuceResult(getAsyncConnection().clientGetname(), LettuceConverters.bytesToString()));
|
||||
return null;
|
||||
}
|
||||
return LettuceConverters.toString(getConnection().clientGetname());
|
||||
@@ -453,7 +453,7 @@ class LettuceServerCommands implements RedisServerCommands {
|
||||
throw new UnsupportedOperationException("Cannot be called in pipeline mode.");
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().clientList(),
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().clientList(),
|
||||
LettuceConverters.stringToRedisClientListConverter()));
|
||||
return null;
|
||||
}
|
||||
@@ -476,7 +476,7 @@ class LettuceServerCommands implements RedisServerCommands {
|
||||
return;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().slaveof(host, port)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().slaveof(host, port)));
|
||||
return;
|
||||
}
|
||||
getConnection().slaveof(host, port);
|
||||
@@ -498,7 +498,7 @@ class LettuceServerCommands implements RedisServerCommands {
|
||||
return;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().slaveofNoOne()));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().slaveofNoOne()));
|
||||
return;
|
||||
}
|
||||
getConnection().slaveofNoOne();
|
||||
@@ -534,7 +534,7 @@ class LettuceServerCommands implements RedisServerCommands {
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection
|
||||
.newLettuceTxResult(getConnection().migrate(target.getHost(), target.getPort(), key, dbIndex, timeout)));
|
||||
.newLettuceResult(getAsyncConnection().migrate(target.getHost(), target.getPort(), key, dbIndex, timeout)));
|
||||
return;
|
||||
}
|
||||
getConnection().migrate(target.getHost(), target.getPort(), key, dbIndex, timeout);
|
||||
@@ -555,7 +555,7 @@ class LettuceServerCommands implements RedisServerCommands {
|
||||
connection.pipeline(result);
|
||||
}
|
||||
|
||||
private void transaction(LettuceTxResult<?, ?> result) {
|
||||
private void transaction(LettuceResult<?, ?> result) {
|
||||
connection.transaction(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ import java.util.Set;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.data.redis.connection.RedisSetCommands;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceResult.LettuceTxResult;
|
||||
import org.springframework.data.redis.core.Cursor;
|
||||
import org.springframework.data.redis.core.KeyBoundCursor;
|
||||
import org.springframework.data.redis.core.ScanIteration;
|
||||
@@ -63,7 +62,7 @@ class LettuceSetCommands implements RedisSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().sadd(key, values)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().sadd(key, values)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().sadd(key, values);
|
||||
@@ -87,7 +86,7 @@ class LettuceSetCommands implements RedisSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().scard(key)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().scard(key)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().scard(key);
|
||||
@@ -112,7 +111,7 @@ class LettuceSetCommands implements RedisSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().sdiff(keys)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().sdiff(keys)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().sdiff(keys);
|
||||
@@ -138,7 +137,7 @@ class LettuceSetCommands implements RedisSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().sdiffstore(destKey, keys)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().sdiffstore(destKey, keys)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().sdiffstore(destKey, keys);
|
||||
@@ -163,7 +162,7 @@ class LettuceSetCommands implements RedisSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().sinter(keys)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().sinter(keys)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().sinter(keys);
|
||||
@@ -189,7 +188,7 @@ class LettuceSetCommands implements RedisSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().sinterstore(destKey, keys)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().sinterstore(destKey, keys)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().sinterstore(destKey, keys);
|
||||
@@ -214,7 +213,7 @@ class LettuceSetCommands implements RedisSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().sismember(key, value)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().sismember(key, value)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().sismember(key, value);
|
||||
@@ -238,7 +237,7 @@ class LettuceSetCommands implements RedisSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().smembers(key)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().smembers(key)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().smembers(key);
|
||||
@@ -264,7 +263,7 @@ class LettuceSetCommands implements RedisSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().smove(srcKey, destKey, value)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().smove(srcKey, destKey, value)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().smove(srcKey, destKey, value);
|
||||
@@ -288,7 +287,7 @@ class LettuceSetCommands implements RedisSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().spop(key)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().spop(key)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().spop(key);
|
||||
@@ -312,7 +311,7 @@ class LettuceSetCommands implements RedisSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().spop(key, count),
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().spop(key, count),
|
||||
(Converter<Set<byte[]>, List<byte[]>>) ArrayList::new));
|
||||
return null;
|
||||
}
|
||||
@@ -337,7 +336,7 @@ class LettuceSetCommands implements RedisSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().srandmember(key)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().srandmember(key)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().srandmember(key);
|
||||
@@ -361,8 +360,7 @@ class LettuceSetCommands implements RedisSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().srandmember(key, count),
|
||||
LettuceConverters.bytesCollectionToBytesList()));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().srandmember(key, count)));
|
||||
return null;
|
||||
}
|
||||
return LettuceConverters.toBytesList(getConnection().srandmember(key, count));
|
||||
@@ -388,7 +386,7 @@ class LettuceSetCommands implements RedisSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().srem(key, values)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().srem(key, values)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().srem(key, values);
|
||||
@@ -413,7 +411,7 @@ class LettuceSetCommands implements RedisSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().sunion(keys)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().sunion(keys)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().sunion(keys);
|
||||
@@ -439,7 +437,7 @@ class LettuceSetCommands implements RedisSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().sunionstore(destKey, keys)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().sunionstore(destKey, keys)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().sunionstore(destKey, keys);
|
||||
@@ -506,7 +504,7 @@ class LettuceSetCommands implements RedisSetCommands {
|
||||
connection.pipeline(result);
|
||||
}
|
||||
|
||||
private void transaction(LettuceTxResult result) {
|
||||
private void transaction(LettuceResult result) {
|
||||
connection.transaction(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ import java.util.concurrent.Future;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.data.redis.connection.RedisStringCommands;
|
||||
import org.springframework.data.redis.connection.convert.Converters;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceResult.LettuceTxResult;
|
||||
import org.springframework.data.redis.core.types.Expiration;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -56,7 +55,7 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().get(key)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().get(key)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().get(key);
|
||||
@@ -81,7 +80,7 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().getset(key, value)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().getset(key, value)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().getset(key, value);
|
||||
@@ -108,7 +107,7 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(
|
||||
connection.newLettuceTxResult(getConnection().mget(keys), LettuceConverters.keyValueListUnwrapper()));
|
||||
connection.newLettuceResult(getAsyncConnection().mget(keys), LettuceConverters.keyValueListUnwrapper()));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -136,7 +135,7 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(
|
||||
connection.newLettuceTxResult(getConnection().set(key, value), Converters.stringToBooleanConverter()));
|
||||
connection.newLettuceResult(getAsyncConnection().set(key, value), Converters.stringToBooleanConverter()));
|
||||
return null;
|
||||
}
|
||||
return Converters.stringToBoolean(getConnection().set(key, value));
|
||||
@@ -165,8 +164,8 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(
|
||||
getConnection().set(key, value, LettuceConverters.toSetArgs(expiration, option)),
|
||||
transaction(connection.newLettuceResult(
|
||||
getAsyncConnection().set(key, value, LettuceConverters.toSetArgs(expiration, option)),
|
||||
Converters.stringToBooleanConverter(), () -> false));
|
||||
return null;
|
||||
}
|
||||
@@ -193,7 +192,7 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().setnx(key, value)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().setnx(key, value)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().setnx(key, value);
|
||||
@@ -219,7 +218,7 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().setex(key, seconds, value),
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().setex(key, seconds, value),
|
||||
Converters.stringToBooleanConverter()));
|
||||
return null;
|
||||
}
|
||||
@@ -246,7 +245,7 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().psetex(key, milliseconds, value),
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().psetex(key, milliseconds, value),
|
||||
Converters.stringToBooleanConverter()));
|
||||
return null;
|
||||
}
|
||||
@@ -271,7 +270,8 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().mset(tuples), Converters.stringToBooleanConverter()));
|
||||
transaction(
|
||||
connection.newLettuceResult(getAsyncConnection().mset(tuples), Converters.stringToBooleanConverter()));
|
||||
return null;
|
||||
}
|
||||
return Converters.stringToBoolean(getConnection().mset(tuples));
|
||||
@@ -295,7 +295,7 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().msetnx(tuples)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().msetnx(tuples)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().msetnx(tuples);
|
||||
@@ -319,7 +319,7 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().incr(key)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().incr(key)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().incr(key);
|
||||
@@ -343,7 +343,7 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().incrby(key, value)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().incrby(key, value)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().incrby(key, value);
|
||||
@@ -367,7 +367,7 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().incrbyfloat(key, value)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().incrbyfloat(key, value)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().incrbyfloat(key, value);
|
||||
@@ -391,7 +391,7 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().decr(key)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().decr(key)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().decr(key);
|
||||
@@ -415,7 +415,7 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().decrby(key, value)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().decrby(key, value)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().decrby(key, value);
|
||||
@@ -440,7 +440,7 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().append(key, value)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().append(key, value)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().append(key, value);
|
||||
@@ -464,7 +464,7 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().getrange(key, start, end)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().getrange(key, start, end)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().getrange(key, start, end);
|
||||
@@ -489,7 +489,7 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
return;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxStatusResult(getConnection().setrange(key, offset, value)));
|
||||
transaction(connection.newLettuceStatusResult(getAsyncConnection().setrange(key, offset, value)));
|
||||
return;
|
||||
}
|
||||
getConnection().setrange(key, offset, value);
|
||||
@@ -515,7 +515,7 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(
|
||||
connection.newLettuceTxResult(getConnection().getbit(key, offset), LettuceConverters.longToBoolean()));
|
||||
connection.newLettuceResult(getAsyncConnection().getbit(key, offset), LettuceConverters.longToBoolean()));
|
||||
return null;
|
||||
}
|
||||
return LettuceConverters.toBoolean(getConnection().getbit(key, offset));
|
||||
@@ -540,8 +540,9 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().setbit(key, offset, LettuceConverters.toInt(value)),
|
||||
LettuceConverters.longToBooleanConverter()));
|
||||
transaction(
|
||||
connection.newLettuceResult(getAsyncConnection().setbit(key, offset, LettuceConverters.toInt(value)),
|
||||
LettuceConverters.longToBooleanConverter()));
|
||||
return null;
|
||||
}
|
||||
return LettuceConverters.longToBooleanConverter()
|
||||
@@ -566,7 +567,7 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().bitcount(key)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().bitcount(key)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().bitcount(key);
|
||||
@@ -590,7 +591,7 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().bitcount(key, start, end)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().bitcount(key, start, end)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().bitcount(key, start, end);
|
||||
@@ -618,7 +619,7 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(syncBitOp(op, destination, keys)));
|
||||
transaction(connection.newLettuceResult(asyncBitOp(op, destination, keys)));
|
||||
return null;
|
||||
}
|
||||
return syncBitOp(op, destination, keys);
|
||||
@@ -680,7 +681,7 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().strlen(key)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().strlen(key)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().strlen(key);
|
||||
@@ -701,7 +702,7 @@ class LettuceStringCommands implements RedisStringCommands {
|
||||
connection.pipeline(result);
|
||||
}
|
||||
|
||||
private void transaction(LettuceTxResult result) {
|
||||
private void transaction(LettuceResult result) {
|
||||
connection.transaction(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ import java.util.Set;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.data.redis.connection.RedisZSetCommands;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceResult.LettuceTxResult;
|
||||
import org.springframework.data.redis.core.Cursor;
|
||||
import org.springframework.data.redis.core.KeyBoundCursor;
|
||||
import org.springframework.data.redis.core.ScanIteration;
|
||||
@@ -63,8 +62,8 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(
|
||||
connection.newLettuceTxResult(getConnection().zadd(key, score, value), LettuceConverters.longToBoolean()));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().zadd(key, score, value),
|
||||
LettuceConverters.longToBoolean()));
|
||||
return null;
|
||||
}
|
||||
return LettuceConverters.toBoolean(getConnection().zadd(key, score, value));
|
||||
@@ -91,7 +90,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(
|
||||
connection.newLettuceTxResult(getConnection().zadd(key, LettuceConverters.toObjects(tuples).toArray())));
|
||||
connection.newLettuceResult(getAsyncConnection().zadd(key, LettuceConverters.toObjects(tuples).toArray())));
|
||||
return null;
|
||||
}
|
||||
return getConnection().zadd(key, LettuceConverters.toObjects(tuples).toArray());
|
||||
@@ -117,7 +116,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().zrem(key, values)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().zrem(key, values)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().zrem(key, values);
|
||||
@@ -142,7 +141,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().zincrby(key, increment, value)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().zincrby(key, increment, value)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().zincrby(key, increment, value);
|
||||
@@ -167,7 +166,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().zrank(key, value)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().zrank(key, value)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().zrank(key, value);
|
||||
@@ -191,7 +190,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().zrevrank(key, value)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().zrevrank(key, value)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().zrevrank(key, value);
|
||||
@@ -216,7 +215,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().zrange(key, start, end),
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().zrange(key, start, end),
|
||||
LettuceConverters.bytesListToBytesSet()));
|
||||
return null;
|
||||
}
|
||||
@@ -242,7 +241,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().zrangeWithScores(key, start, end),
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().zrangeWithScores(key, start, end),
|
||||
LettuceConverters.scoredValuesToTupleSet()));
|
||||
return null;
|
||||
}
|
||||
@@ -278,11 +277,11 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
}
|
||||
if (isQueueing()) {
|
||||
if (limit.isUnlimited()) {
|
||||
transaction(connection.newLettuceTxResult(
|
||||
getConnection().zrangebyscoreWithScores(key, LettuceConverters.toRange(range)),
|
||||
transaction(connection.newLettuceResult(
|
||||
getAsyncConnection().zrangebyscoreWithScores(key, LettuceConverters.toRange(range)),
|
||||
LettuceConverters.scoredValuesToTupleSet()));
|
||||
} else {
|
||||
transaction(connection.newLettuceTxResult(getConnection().zrangebyscoreWithScores(key,
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().zrangebyscoreWithScores(key,
|
||||
LettuceConverters.toRange(range), LettuceConverters.toLimit(limit)),
|
||||
LettuceConverters.scoredValuesToTupleSet()));
|
||||
}
|
||||
@@ -315,7 +314,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().zrevrange(key, start, end),
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().zrevrange(key, start, end),
|
||||
LettuceConverters.bytesListToBytesSet()));
|
||||
return null;
|
||||
}
|
||||
@@ -341,7 +340,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().zrevrangeWithScores(key, start, end),
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().zrevrangeWithScores(key, start, end),
|
||||
LettuceConverters.scoredValuesToTupleSet()));
|
||||
return null;
|
||||
}
|
||||
@@ -378,12 +377,12 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
if (isQueueing()) {
|
||||
if (limit.isUnlimited()) {
|
||||
transaction(
|
||||
connection.newLettuceTxResult(getConnection().zrevrangebyscore(key, LettuceConverters.toRange(range)),
|
||||
connection.newLettuceResult(getAsyncConnection().zrevrangebyscore(key, LettuceConverters.toRange(range)),
|
||||
LettuceConverters.bytesListToBytesSet()));
|
||||
} else {
|
||||
transaction(connection.newLettuceTxResult(
|
||||
getConnection().zrevrangebyscore(key, LettuceConverters.toRange(range), LettuceConverters.toLimit(limit)),
|
||||
LettuceConverters.bytesListToBytesSet()));
|
||||
transaction(
|
||||
connection.newLettuceResult(getAsyncConnection().zrevrangebyscore(key, LettuceConverters.toRange(range),
|
||||
LettuceConverters.toLimit(limit)), LettuceConverters.bytesListToBytesSet()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -424,11 +423,11 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
|
||||
if (isQueueing()) {
|
||||
if (limit.isUnlimited()) {
|
||||
transaction(connection.newLettuceTxResult(
|
||||
getConnection().zrevrangebyscoreWithScores(key, LettuceConverters.toRange(range)),
|
||||
transaction(connection.newLettuceResult(
|
||||
getAsyncConnection().zrevrangebyscoreWithScores(key, LettuceConverters.toRange(range)),
|
||||
LettuceConverters.scoredValuesToTupleSet()));
|
||||
} else {
|
||||
transaction(connection.newLettuceTxResult(getConnection().zrevrangebyscoreWithScores(key,
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().zrevrangebyscoreWithScores(key,
|
||||
LettuceConverters.toRange(range), LettuceConverters.toLimit(limit)),
|
||||
LettuceConverters.scoredValuesToTupleSet()));
|
||||
}
|
||||
@@ -460,7 +459,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().zcount(key, LettuceConverters.toRange(range))));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().zcount(key, LettuceConverters.toRange(range))));
|
||||
return null;
|
||||
}
|
||||
return getConnection().zcount(key, LettuceConverters.toRange(range));
|
||||
@@ -484,7 +483,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().zcard(key)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().zcard(key)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().zcard(key);
|
||||
@@ -509,7 +508,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().zscore(key, value)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().zscore(key, value)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().zscore(key, value);
|
||||
@@ -533,7 +532,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().zremrangebyrank(key, start, end)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().zremrangebyrank(key, start, end)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().zremrangebyrank(key, start, end);
|
||||
@@ -560,7 +559,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(
|
||||
connection.newLettuceTxResult(getConnection().zremrangebyscore(key, LettuceConverters.toRange(range))));
|
||||
connection.newLettuceResult(getAsyncConnection().zremrangebyscore(key, LettuceConverters.toRange(range))));
|
||||
return null;
|
||||
}
|
||||
return getConnection().zremrangebyscore(key, LettuceConverters.toRange(range));
|
||||
@@ -588,7 +587,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().zunionstore(destKey, storeArgs, sets)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().zunionstore(destKey, storeArgs, sets)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().zunionstore(destKey, storeArgs, sets);
|
||||
@@ -614,7 +613,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().zunionstore(destKey, sets)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().zunionstore(destKey, sets)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().zunionstore(destKey, sets);
|
||||
@@ -642,7 +641,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().zinterstore(destKey, storeArgs, sets)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().zinterstore(destKey, storeArgs, sets)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().zinterstore(destKey, storeArgs, sets);
|
||||
@@ -668,7 +667,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().zinterstore(destKey, sets)));
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().zinterstore(destKey, sets)));
|
||||
return null;
|
||||
}
|
||||
return getConnection().zinterstore(destKey, sets);
|
||||
@@ -742,7 +741,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().zrangebyscore(key, min, max),
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().zrangebyscore(key, min, max),
|
||||
LettuceConverters.bytesListToBytesSet()));
|
||||
return null;
|
||||
}
|
||||
@@ -768,7 +767,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
return null;
|
||||
}
|
||||
if (isQueueing()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().zrangebyscore(key, min, max, offset, count),
|
||||
transaction(connection.newLettuceResult(getAsyncConnection().zrangebyscore(key, min, max, offset, count),
|
||||
LettuceConverters.bytesListToBytesSet()));
|
||||
return null;
|
||||
}
|
||||
@@ -804,12 +803,12 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
if (isQueueing()) {
|
||||
if (limit.isUnlimited()) {
|
||||
transaction(
|
||||
connection.newLettuceTxResult(getConnection().zrangebyscore(key, LettuceConverters.toRange(range)),
|
||||
connection.newLettuceResult(getAsyncConnection().zrangebyscore(key, LettuceConverters.toRange(range)),
|
||||
LettuceConverters.bytesListToBytesSet()));
|
||||
} else {
|
||||
transaction(connection.newLettuceTxResult(
|
||||
getConnection().zrangebyscore(key, LettuceConverters.toRange(range), LettuceConverters.toLimit(limit)),
|
||||
LettuceConverters.bytesListToBytesSet()));
|
||||
transaction(
|
||||
connection.newLettuceResult(getAsyncConnection().zrangebyscore(key, LettuceConverters.toRange(range),
|
||||
LettuceConverters.toLimit(limit)), LettuceConverters.bytesListToBytesSet()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -848,11 +847,12 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
}
|
||||
if (isQueueing()) {
|
||||
if (limit.isUnlimited()) {
|
||||
transaction(connection.newLettuceTxResult(getConnection().zrangebylex(key, LettuceConverters.toRange(range)),
|
||||
LettuceConverters.bytesListToBytesSet()));
|
||||
transaction(
|
||||
connection.newLettuceResult(getAsyncConnection().zrangebylex(key, LettuceConverters.toRange(range)),
|
||||
LettuceConverters.bytesListToBytesSet()));
|
||||
} else {
|
||||
transaction(connection.newLettuceTxResult(
|
||||
getConnection().zrangebylex(key, LettuceConverters.toRange(range), LettuceConverters.toLimit(limit)),
|
||||
transaction(connection.newLettuceResult(
|
||||
getAsyncConnection().zrangebylex(key, LettuceConverters.toRange(range), LettuceConverters.toLimit(limit)),
|
||||
LettuceConverters.bytesListToBytesSet()));
|
||||
}
|
||||
return null;
|
||||
@@ -882,7 +882,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
|
||||
connection.pipeline(result);
|
||||
}
|
||||
|
||||
private void transaction(LettuceTxResult result) {
|
||||
private void transaction(LettuceResult result) {
|
||||
connection.transaction(result);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user