Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into xpending-idle
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/test/java/io/lettuce/core/commands/StreamCommandIntegrationTests.java
  • Loading branch information
dengliming committed Mar 2, 2021
2 parents 9833d79 + 76e3bec commit 445b499
Show file tree
Hide file tree
Showing 111 changed files with 5,339 additions and 1,029 deletions.
417 changes: 133 additions & 284 deletions RELEASE-NOTES.md

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions 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.1.0.BUILD-SNAPSHOT</version>
<version>6.1.0-BUILD-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Lettuce</name>
Expand Down Expand Up @@ -60,13 +60,13 @@
<junit5.version>5.7.0</junit5.version>
<hamcrest-library.version>2.2</hamcrest-library.version>
<hdr-histogram-version>2.1.12</hdr-histogram-version>
<kotlin.version>1.3.72</kotlin.version>
<kotlinx-coroutines.version>1.3.8</kotlinx-coroutines.version>
<kotlin.version>1.4.30</kotlin.version>
<kotlinx-coroutines.version>1.4.2</kotlinx-coroutines.version>
<latencyutils.version>2.0.3</latencyutils.version>
<log4j2-version>2.13.3</log4j2-version>
<micrometer.version>1.6.0</micrometer.version>
<mockito.version>3.5.15</mockito.version>
<netty.version>4.1.56.Final</netty.version>
<netty.version>4.1.58.Final</netty.version>
<openwebbeans.version>2.0.19</openwebbeans.version>
<reactor.version>3.3.11.RELEASE</reactor.version>
<rxjava.version>1.3.8</rxjava.version>
Expand Down Expand Up @@ -231,7 +231,7 @@
<dependency>
<groupId>io.netty.incubator</groupId>
<artifactId>netty-incubator-transport-native-io_uring</artifactId>
<version>0.0.1.Final</version>
<version>0.0.3.Final</version>
<classifier>linux-x86_64</classifier>
<optional>true</optional>
</dependency>
Expand Down
4 changes: 2 additions & 2 deletions src/main/asciidoc/ha-sharding.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
[[master-slave]]
[[master-replica]]
[[upstream-replica]]
=== Upstream/Replica
=== Master/Replica

include::{ext-doc}/Upstream-Replica.asciidoc[leveloffset=+2]
include::{ext-doc}/Master-Replica.asciidoc[leveloffset=+2]

[[redis-sentinel]]
=== Redis Sentinel
Expand Down
1 change: 1 addition & 0 deletions src/main/asciidoc/new-features.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* Configuration of extended Keep-Alive options through `KeepAliveOptions` (only available for some transports/Java versions).
* Configuration of netty's `AddressResolverGroup` through `ClientResources`.
Uses `DnsAddressResolverGroup` when `netty-resolver-dns` is on the classpath.
* Add support for Redis ACL commands.

[[new-features.6-0-0]]
== What's new in Lettuce 6.0
Expand Down
2 changes: 1 addition & 1 deletion src/main/asciidoc/overview.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ If you encounter a bug or want to suggest an improvement, please create a ticket
=== Where to go from here

* Head to <<getting-started>> if you feel like jumping straight into the code.
* Go to <<ha-sharding>> for Upstream/Replica ("Master/Slave"), Redis Sentinel and Redis Cluster topics.
* Go to <<ha-sharding>> for Master/Replica ("Master/Slave"), Redis Sentinel and Redis Cluster topics.
* In order to dig deeper into the core features of Reactor:
** If you’re looking for client configuration options, performance related behavior and how to use various transports, go to <<advanced-usage>>.
** See <<integration-extension>> for extending Lettuce with codecs or integrate it in your CDI/Spring application.
Expand Down
134 changes: 127 additions & 7 deletions src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import static io.lettuce.core.protocol.CommandType.*;

import java.time.Duration;
import java.time.Instant;
import java.util.Date;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -56,11 +57,12 @@
* @author Andrey Shlykov
*/
@SuppressWarnings("unchecked")
public abstract class AbstractRedisAsyncCommands<K, V> implements 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>, BaseRedisAsyncCommands<K, V>, RedisTransactionalAsyncCommands<K, V>,
RedisGeoAsyncCommands<K, V>, RedisClusterAsyncCommands<K, V> {
public abstract class AbstractRedisAsyncCommands<K, V> implements RedisAclAsyncCommands<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>,
BaseRedisAsyncCommands<K, V>, RedisTransactionalAsyncCommands<K, V>, RedisGeoAsyncCommands<K, V>,
RedisClusterAsyncCommands<K, V> {

private final StatefulConnection<K, V> connection;

Expand All @@ -77,6 +79,81 @@ public AbstractRedisAsyncCommands(StatefulConnection<K, V> connection, RedisCode
this.commandBuilder = new RedisCommandBuilder<>(codec);
}

@Override
public RedisFuture<Set<AclCategory>> aclCat() {
return dispatch(commandBuilder.aclCat());
}

@Override
public RedisFuture<Set<CommandType>> aclCat(AclCategory category) {
return dispatch(commandBuilder.aclCat(category));
}

@Override
public RedisFuture<Long> aclDeluser(String... usernames) {
return dispatch(commandBuilder.aclDeluser(usernames));
}

@Override
public RedisFuture<String> aclGenpass() {
return dispatch(commandBuilder.aclGenpass());
}

@Override
public RedisFuture<String> aclGenpass(int bits) {
return dispatch(commandBuilder.aclGenpass(bits));
}

@Override
public RedisFuture<List<Object>> aclGetuser(String username) {
return dispatch(commandBuilder.aclGetuser(username));
}

@Override
public RedisFuture<List<String>> aclList() {
return dispatch(commandBuilder.aclList());
}

@Override
public RedisFuture<String> aclLoad() {
return dispatch(commandBuilder.aclLoad());
}

@Override
public RedisFuture<List<Map<String, Object>>> aclLog() {
return dispatch(commandBuilder.aclLog());
}

@Override
public RedisFuture<List<Map<String, Object>>> aclLog(int count) {
return dispatch(commandBuilder.aclLog(count));
}

@Override
public RedisFuture<String> aclLogReset() {
return dispatch(commandBuilder.aclLogReset());
}

@Override
public RedisFuture<String> aclSave() {
return dispatch(commandBuilder.aclSave());
}

@Override
public RedisFuture<String> aclSetuser(String username, AclSetuserArgs args) {
return dispatch(commandBuilder.aclSetuser(username, args));
}

@Override
public RedisFuture<List<String>> aclUsers() {
return dispatch(commandBuilder.aclUsers());
}

@Override
public RedisFuture<String> aclWhoami() {
return dispatch(commandBuilder.aclWhoami());
}

@Override
public RedisFuture<Long> append(K key, V value) {
return dispatch(commandBuilder.append(key, value));
Expand Down Expand Up @@ -592,15 +669,28 @@ public RedisFuture<Boolean> expire(K key, long seconds) {
}

@Override
public RedisFuture<Boolean> expireat(K key, Date timestamp) {
return expireat(key, timestamp.getTime() / 1000);
public RedisFuture<Boolean> expire(K key, Duration seconds) {
LettuceAssert.notNull(seconds, "Timeout must not be null");
return expire(key, seconds.toMillis() / 1000);
}

@Override
public RedisFuture<Boolean> expireat(K key, long timestamp) {
return dispatch(commandBuilder.expireat(key, timestamp));
}

@Override
public RedisFuture<Boolean> expireat(K key, Date timestamp) {
LettuceAssert.notNull(timestamp, "Timestamp must not be null");
return expireat(key, timestamp.getTime() / 1000);
}

@Override
public RedisFuture<Boolean> expireat(K key, Instant timestamp) {
LettuceAssert.notNull(timestamp, "Timestamp must not be null");
return expireat(key, timestamp.toEpochMilli() / 1000);
}

@Override
public void flushCommands() {
connection.flushCommands();
Expand Down Expand Up @@ -703,6 +793,23 @@ protected RedisFuture<List<GeoWithin<V>>> georadiusbymember_ro(K key, V member,
return dispatch(commandBuilder.georadiusbymember(GEORADIUSBYMEMBER_RO, key, member, distance, unit.name(), geoArgs));
}

@Override
public RedisFuture<Set<V>> geosearch(K key, GeoSearch.GeoRef<K> reference, GeoSearch.GeoPredicate predicate) {
return dispatch(commandBuilder.geosearch(key, reference, predicate));
}

@Override
public RedisFuture<List<GeoWithin<V>>> geosearch(K key, GeoSearch.GeoRef<K> reference, GeoSearch.GeoPredicate predicate,
GeoArgs geoArgs) {
return dispatch(commandBuilder.geosearch(key, reference, predicate, geoArgs));
}

@Override
public RedisFuture<Long> geosearchstore(K destination, K key, GeoSearch.GeoRef<K> reference,
GeoSearch.GeoPredicate predicate, GeoArgs geoArgs, boolean storeDist) {
return dispatch(commandBuilder.geosearchstore(destination, key, reference, predicate, geoArgs, storeDist));
}

@Override
public RedisFuture<V> get(K key) {
return dispatch(commandBuilder.get(key));
Expand Down Expand Up @@ -1071,11 +1178,24 @@ public RedisFuture<Boolean> pexpire(K key, long milliseconds) {
return dispatch(commandBuilder.pexpire(key, milliseconds));
}

@Override
public RedisFuture<Boolean> pexpire(K key, Duration milliseconds) {
LettuceAssert.notNull(milliseconds, "Timeout must not be null");
return pexpire(key, milliseconds.toMillis());
}

@Override
public RedisFuture<Boolean> pexpireat(K key, Date timestamp) {
LettuceAssert.notNull(timestamp, "Timestamp must not be null");
return pexpireat(key, timestamp.getTime());
}

@Override
public RedisFuture<Boolean> pexpireat(K key, Instant timestamp) {
LettuceAssert.notNull(timestamp, "Timestamp must not be null");
return pexpireat(key, timestamp.toEpochMilli());
}

@Override
public RedisFuture<Boolean> pexpireat(K key, long timestamp) {
return dispatch(commandBuilder.pexpireat(key, timestamp));
Expand Down
Loading

0 comments on commit 445b499

Please sign in to comment.