Add support for CONFIG REWRITE.
Signed-off-by: Manousos Mathioudakis <manoumathioudakis@yahoo.gr> Closes #1992 Original pull request: #2012.
This commit is contained in:
committed by
Mark Paluch
parent
3a1fbe1cf7
commit
2d56eaf3c6
@@ -3731,6 +3731,11 @@ public class DefaultStringRedisConnection implements StringRedisConnection, Deco
|
||||
delegate.migrate(key, target, dbIndex, option, timeout);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rewriteConfig() {
|
||||
delegate.rewriteConfig();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.redis.connection.StringRedisConnection#xAck(java.lang.String, java.lang.String, RecordId[])
|
||||
|
||||
@@ -280,4 +280,9 @@ public interface RedisServerCommands {
|
||||
* @see <a href="https://redis.io/commands/migrate">Redis Documentation: MIGRATE</a>
|
||||
*/
|
||||
void migrate(byte[] key, RedisNode target, int dbIndex, @Nullable MigrateOption option, long timeout);
|
||||
|
||||
/**
|
||||
* Rewrites the redis.conf file.
|
||||
*/
|
||||
void rewriteConfig();
|
||||
}
|
||||
|
||||
@@ -869,6 +869,11 @@ public class JedisClusterConnection implements DefaultedRedisClusterConnection {
|
||||
throw new UnsupportedOperationException("Sentinel is currently not supported for JedisClusterConnection.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rewriteConfig() {
|
||||
serverCommands().rewriteConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Jedis} specific {@link ClusterCommandCallback}.
|
||||
*
|
||||
|
||||
@@ -520,6 +520,12 @@ class JedisClusterServerCommands implements RedisClusterServerCommands {
|
||||
node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rewriteConfig() {
|
||||
connection.getClusterCommandExecutor()
|
||||
.executeCommandOnAllNodes((JedisClusterCommandCallback<String>) client -> client.configRewrite());
|
||||
}
|
||||
|
||||
private Long convertListOfStringToTime(List<String> serverTimeInformation, TimeUnit timeUnit) {
|
||||
|
||||
Assert.notEmpty(serverTimeInformation, "Received invalid result from server. Expected 2 items in collection.");
|
||||
|
||||
@@ -806,4 +806,8 @@ public class JedisConnection extends AbstractRedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rewriteConfig() {
|
||||
serverCommands().rewriteConfig();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,6 +317,11 @@ class JedisServerCommands implements RedisServerCommands {
|
||||
target.getPort(), key, dbIndex, timeoutToUse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rewriteConfig() {
|
||||
connection.invokeStatus().just(Jedis::configRewrite);
|
||||
}
|
||||
|
||||
private boolean isPipelined() {
|
||||
return connection.isPipelined();
|
||||
}
|
||||
|
||||
@@ -137,6 +137,11 @@ public class LettuceConnection extends AbstractRedisConnection {
|
||||
return LettuceResultBuilder.<T, R> forResponse(resultHolder).buildStatusResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rewriteConfig() {
|
||||
serverCommands().rewriteConfig();
|
||||
}
|
||||
|
||||
private class LettuceTransactionResultConverter<T> extends TransactionResultConverter<T> {
|
||||
public LettuceTransactionResultConverter(Queue<FutureResult<T>> txResults,
|
||||
Converter<Exception, DataAccessException> exceptionConverter) {
|
||||
|
||||
@@ -304,6 +304,11 @@ class LettuceServerCommands implements RedisServerCommands {
|
||||
connection.invoke().just(RedisKeyAsyncCommands::migrate, target.getHost(), target.getPort(), key, dbIndex, timeout);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rewriteConfig() {
|
||||
connection.invoke().just(RedisServerAsyncCommands::configRewrite);
|
||||
}
|
||||
|
||||
public RedisClusterCommands<byte[], byte[]> getConnection() {
|
||||
return connection.getConnection();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user