Skip to content
Closed

7.0.x #2283

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Basic Usage
```java
RedisClient client = RedisClient.create("redis://localhost");
StatefulRedisConnection<String, String> connection = client.connect();
RedisStringCommands sync = connection.sync();
RedisStringCommands<String, String> sync = connection.sync();
String value = sync.get("key");
```

Expand Down Expand Up @@ -135,9 +135,9 @@ Pub/Sub
-------

```java
RedisPubSubCommands<String, String> connection = client.connectPubSub().sync();
connection.getStatefulConnection().addListener(new RedisPubSubListener<String, String>() { ... })
connection.subscribe("channel")
StatefulRedisPubSubConnection<String, String> connection = client.connectPubSub();
connection.addListener(new RedisPubSubListener<String, String>() { ... })
connection.sync().subscribe("channel")
```

Cloud Provider Compatibility
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
<version>6.2.0.BUILD-SNAPSHOT</version>
<version>7.0.0.BUILD-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Lettuce</name>
Expand Down
24 changes: 2 additions & 22 deletions src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
* @author Andrey Shlykov
*/
@SuppressWarnings("unchecked")
public abstract class AbstractRedisAsyncCommands<K, V> implements RedisAclAsyncCommands<K,V>,
public abstract class AbstractRedisAsyncCommands<K, V>
implements RedisAclAsyncCommands<K, V>, RedisConnectionAsyncCommands<K, V>,
RedisHashAsyncCommands<K, V>, RedisKeyAsyncCommands<K, V>, RedisStringAsyncCommands<K, V>,
RedisListAsyncCommands<K, V>, RedisSetAsyncCommands<K, V>, RedisSortedSetAsyncCommands<K, V>,
RedisScriptingAsyncCommands<K, V>, RedisServerAsyncCommands<K, V>, RedisHLLAsyncCommands<K, V>,
Expand Down Expand Up @@ -747,11 +748,6 @@ public RedisFuture<Boolean> expireat(K key, Instant timestamp) {
return expireat(key, timestamp.toEpochMilli() / 1000);
}

@Override
public void flushCommands() {
connection.flushCommands();
}

@Override
public RedisFuture<String> flushall() {
return dispatch(commandBuilder.flushall());
Expand Down Expand Up @@ -1111,11 +1107,6 @@ public RedisFuture<String> info(String section) {
return dispatch(commandBuilder.info(section));
}

@Override
public boolean isOpen() {
return connection.isOpen();
}

@Override
public RedisFuture<List<K>> keys(K pattern) {
return dispatch(commandBuilder.keys(pattern));
Expand Down Expand Up @@ -1417,11 +1408,6 @@ public RedisFuture<String> replicaofNoOne() {
return dispatch(commandBuilder.replicaofNoOne());
}

@Override
public void reset() {
getConnection().reset();
}

@Override
public RedisFuture<String> restore(K key, long ttl, byte[] value) {
return dispatch(commandBuilder.restore(key, value, RestoreArgs.Builder.ttl(ttl)));
Expand Down Expand Up @@ -1586,12 +1572,6 @@ public RedisFuture<V> setGet(K key, V value, SetArgs setArgs) {
return dispatch(commandBuilder.setGet(key, value, setArgs));
}

@Override
public void setAutoFlushCommands(boolean autoFlush) {
connection.setAutoFlushCommands(autoFlush);
}

@Override
public void setTimeout(Duration timeout) {
connection.setTimeout(timeout);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/lettuce/core/AbstractRedisClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
import java.util.concurrent.atomic.AtomicInteger;

import reactor.core.publisher.Mono;
import io.lettuce.core.api.AsyncCloseable;
import io.lettuce.core.event.command.CommandListener;
import io.lettuce.core.event.connection.ConnectEvent;
import io.lettuce.core.event.connection.ConnectionCreatedEvent;
import io.lettuce.core.event.jfr.EventRecorder;
import io.lettuce.core.internal.AsyncCloseable;
import io.lettuce.core.internal.Exceptions;
import io.lettuce.core.internal.Futures;
import io.lettuce.core.internal.LettuceAssert;
Expand Down
24 changes: 2 additions & 22 deletions src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
* @author Andrey Shlykov
* @since 4.0
*/
public abstract class AbstractRedisReactiveCommands<K, V> implements RedisAclReactiveCommands<K, V>,
public abstract class AbstractRedisReactiveCommands<K, V>
implements RedisAclReactiveCommands<K, V>, RedisConnectionReactiveCommands<K, V>,
RedisHashReactiveCommands<K, V>, RedisKeyReactiveCommands<K, V>, RedisStringReactiveCommands<K, V>,
RedisListReactiveCommands<K, V>, RedisSetReactiveCommands<K, V>, RedisSortedSetReactiveCommands<K, V>,
RedisScriptingReactiveCommands<K, V>, RedisServerReactiveCommands<K, V>, RedisHLLReactiveCommands<K, V>,
Expand Down Expand Up @@ -805,11 +806,6 @@ public Mono<Boolean> expireat(K key, Instant timestamp) {
return expireat(key, timestamp.toEpochMilli() / 1000);
}

@Override
public void flushCommands() {
connection.flushCommands();
}

@Override
public Mono<String> flushall() {
return createMono(commandBuilder::flushall);
Expand Down Expand Up @@ -1172,7 +1168,6 @@ public Mono<String> info(String section) {
return createMono(() -> commandBuilder.info(section));
}

@Override
public boolean isOpen() {
return connection.isOpen();
}
Expand Down Expand Up @@ -1492,11 +1487,6 @@ public Mono<String> replicaofNoOne() {
return createMono(() -> commandBuilder.replicaofNoOne());
}

@Override
public void reset() {
getConnection().reset();
}

@Override
public Mono<String> restore(K key, long ttl, byte[] value) {
return createMono(() -> commandBuilder.restore(key, value, RestoreArgs.Builder.ttl(ttl)));
Expand Down Expand Up @@ -1661,16 +1651,6 @@ public Mono<V> setGet(K key, V value, SetArgs setArgs) {
return createMono(() -> commandBuilder.setGet(key, value, setArgs));
}

@Override
public void setAutoFlushCommands(boolean autoFlush) {
connection.setAutoFlushCommands(autoFlush);
}

@Override
public void setTimeout(Duration timeout) {
connection.setTimeout(timeout);
}

@Override
public Mono<Long> setbit(K key, long offset, int value) {
return createMono(() -> commandBuilder.setbit(key, offset, value));
Expand Down
1 change: 0 additions & 1 deletion src/main/java/io/lettuce/core/RedisAsyncCommandsImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public RedisAsyncCommandsImpl(StatefulRedisConnection<K, V> connection, RedisCod
super(connection, codec);
}

@Override
public StatefulRedisConnection<K, V> getStatefulConnection() {
return (StatefulRedisConnection<K, V>) super.getConnection();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/lettuce/core/RedisChannelHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;

import io.lettuce.core.api.AsyncCloseable;
import io.lettuce.core.api.StatefulConnection;
import io.lettuce.core.internal.AsyncCloseable;
import io.lettuce.core.internal.LettuceAssert;
import io.lettuce.core.protocol.CommandExpiryWriter;
import io.lettuce.core.protocol.CommandWrapper;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/lettuce/core/RedisChannelWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.util.Collection;
import java.util.concurrent.CompletableFuture;

import io.lettuce.core.internal.AsyncCloseable;
import io.lettuce.core.api.AsyncCloseable;
import io.lettuce.core.protocol.ConnectionFacade;
import io.lettuce.core.protocol.RedisCommand;
import io.lettuce.core.resource.ClientResources;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public RedisReactiveCommandsImpl(StatefulRedisConnection<K, V> connection, Redis
super(connection, codec);
}

@Override
public StatefulRedisConnection<K, V> getStatefulConnection() {
return (StatefulRedisConnection<K, V>) super.getConnection();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.lettuce.core.internal;
package io.lettuce.core.api;

import java.util.concurrent.CompletableFuture;

/**
* A {@link AsyncCloseable} is a resource that can be closed. The {@link #closeAsync()} method is invoked to request resources
* release that the object is holding (such as open files).
*
* @since 5.1
* @since 6.2
* @author Mark Paluch
*/
public interface AsyncCloseable {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/io/lettuce/core/api/StatefulConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import io.lettuce.core.ClientOptions;
import io.lettuce.core.RedisConnectionStateListener;
import io.lettuce.core.internal.AsyncCloseable;
import io.lettuce.core.protocol.RedisCommand;
import io.lettuce.core.resource.ClientResources;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,29 +149,4 @@ public interface BaseRedisAsyncCommands<K, V> {
*/
<T> RedisFuture<T> dispatch(ProtocolKeyword type, CommandOutput<K, V, T> output, CommandArgs<K, V> args);

/**
* @return {@code true} if the connection is open (connected and not closed).
*/
boolean isOpen();

/**
* Reset the command state. Queued commands will be canceled and the internal state will be reset. This is useful when the
* internal state machine gets out of sync with the connection.
*/
void reset();

/**
* Disable or enable auto-flush behavior. Default is {@code true}. If autoFlushCommands is disabled, multiple commands can
* be issued without writing them actually to the transport. Commands are buffered until a {@link #flushCommands()} is
* issued. After calling {@link #flushCommands()} commands are sent to the transport and executed by Redis.
*
* @param autoFlush state of autoFlush.
*/
void setAutoFlushCommands(boolean autoFlush);

/**
* Flush pending commands. This commands forces a flush on the channel and can be used to buffer ("pipeline") commands to
* achieve batching. No-op if channel is not connected.
*/
void flushCommands();
}
24 changes: 0 additions & 24 deletions src/main/java/io/lettuce/core/api/async/RedisAsyncCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package io.lettuce.core.api.async;

import io.lettuce.core.RedisFuture;
import io.lettuce.core.api.StatefulRedisConnection;
import io.lettuce.core.cluster.api.async.RedisClusterAsyncCommands;

/**
Expand All @@ -33,24 +32,6 @@ public interface RedisAsyncCommands<K, V> extends BaseRedisAsyncCommands<K, V>,
RedisSetAsyncCommands<K, V>, RedisSortedSetAsyncCommands<K, V>, RedisStreamAsyncCommands<K, V>,
RedisStringAsyncCommands<K, V>, RedisTransactionalAsyncCommands<K, V> {

/**
* Authenticate to the server.
*
* @param password the password
* @return String simple-string-reply
*/
RedisFuture<String> auth(CharSequence password);

/**
* Authenticate to the server with username and password. Requires Redis 6 or newer.
*
* @param username the username
* @param password the password
* @return String simple-string-reply
* @since 6.0
*/
RedisFuture<String> auth(String username, CharSequence password);

/**
* Change the selected database for the current connection.
*
Expand All @@ -69,9 +50,4 @@ public interface RedisAsyncCommands<K, V> extends BaseRedisAsyncCommands<K, V>,
*/
RedisFuture<String> swapdb(int db1, int db2);

/**
* @return the underlying connection.
*/
StatefulRedisConnection<K, V> getStatefulConnection();

}
Loading