DATAREDIS-532 - Enhance JavaDoc and convert links to Redis documentation.
Extend JavaDoc documentation for Command/Connection/Operation interfaces. Align method ordering in operation interfaces with connection/commands interfaces.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,7 @@ package org.springframework.data.redis.connection;
|
||||
* {@literal HyperLogLog} specific commands supported by Redis.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @since 1.5
|
||||
*/
|
||||
public interface HyperLogLogCommands {
|
||||
@@ -26,25 +27,28 @@ public interface HyperLogLogCommands {
|
||||
/**
|
||||
* Adds given {@literal values} to the HyperLogLog stored at given {@literal key}.
|
||||
*
|
||||
* @param key
|
||||
* @param values
|
||||
* @param key must not be {@literal null}.
|
||||
* @param values must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/pfadd">Redis Documentation: PFADD</a>
|
||||
*/
|
||||
Long pfAdd(byte[] key, byte[]... values);
|
||||
|
||||
/**
|
||||
* Return the approximated cardinality of the structures observed by the HyperLogLog at {@literal key(s)}.
|
||||
*
|
||||
* @param keys
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/pfcount">Redis Documentation: PFCOUNT</a>
|
||||
*/
|
||||
Long pfCount(byte[]... keys);
|
||||
|
||||
/**
|
||||
* Merge N different HyperLogLogs at {@literal sourceKeys} into a single {@literal destinationKey}.
|
||||
*
|
||||
* @param destinationKey
|
||||
* @param sourceKeys
|
||||
* @param destinationKey must not be {@literal null}.
|
||||
* @param sourceKeys must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/pfmerge">Redis Documentation: PFMERGE</a>
|
||||
*/
|
||||
void pfMerge(byte[] destinationKey, byte[]... sourceKeys);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,9 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -42,9 +45,6 @@ import org.springframework.data.redis.connection.RedisGeoCommands.GeoRadiusComma
|
||||
import org.springframework.data.redis.connection.RedisGeoCommands.GeoRadiusCommandArgs.Flag;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* Redis Geo commands executed using reactive infrastructure.
|
||||
*
|
||||
@@ -58,6 +58,7 @@ public interface ReactiveGeoCommands {
|
||||
* {@code GEOADD} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/geoadd">Redis Documentation: GEOADD</a>
|
||||
*/
|
||||
class GeoAddCommand extends KeyCommand {
|
||||
|
||||
@@ -121,6 +122,7 @@ public interface ReactiveGeoCommands {
|
||||
* @param point must not be {@literal null}.
|
||||
* @param member must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/geoadd">Redis Documentation: GEOADD</a>
|
||||
*/
|
||||
default Mono<Long> geoAdd(ByteBuffer key, Point point, ByteBuffer member) {
|
||||
|
||||
@@ -137,6 +139,7 @@ public interface ReactiveGeoCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param location must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/geoadd">Redis Documentation: GEOADD</a>
|
||||
*/
|
||||
default Mono<Long> geoAdd(ByteBuffer key, GeoLocation<ByteBuffer> location) {
|
||||
|
||||
@@ -152,6 +155,7 @@ public interface ReactiveGeoCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param locations must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/geoadd">Redis Documentation: GEOADD</a>
|
||||
*/
|
||||
default Mono<Long> geoAdd(ByteBuffer key, Collection<GeoLocation<ByteBuffer>> locations) {
|
||||
|
||||
@@ -166,6 +170,7 @@ public interface ReactiveGeoCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/geoadd">Redis Documentation: GEOADD</a>
|
||||
*/
|
||||
Flux<NumericResponse<GeoAddCommand, Long>> geoAdd(Publisher<GeoAddCommand> commands);
|
||||
|
||||
@@ -173,6 +178,7 @@ public interface ReactiveGeoCommands {
|
||||
* {@code GEODIST} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/geodist">Redis Documentation: GEODIST</a>
|
||||
*/
|
||||
class GeoDistCommand extends KeyCommand {
|
||||
|
||||
@@ -298,6 +304,7 @@ public interface ReactiveGeoCommands {
|
||||
* @param from must not be {@literal null}.
|
||||
* @param to must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/geodist">Redis Documentation: GEODIST</a>
|
||||
*/
|
||||
default Mono<Distance> geoDist(ByteBuffer key, ByteBuffer from, ByteBuffer to) {
|
||||
return geoDist(key, from, to, null);
|
||||
@@ -311,6 +318,7 @@ public interface ReactiveGeoCommands {
|
||||
* @param to must not be {@literal null}.
|
||||
* @param metric can be {@literal null} and defaults to {@link DistanceUnit#METERS}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/geodist">Redis Documentation: GEODIST</a>
|
||||
*/
|
||||
default Mono<Distance> geoDist(ByteBuffer key, ByteBuffer from, ByteBuffer to, Metric metric) {
|
||||
|
||||
@@ -328,6 +336,7 @@ public interface ReactiveGeoCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/geodist">Redis Documentation: GEODIST</a>
|
||||
*/
|
||||
Flux<CommandResponse<GeoDistCommand, Distance>> geoDist(Publisher<GeoDistCommand> commands);
|
||||
|
||||
@@ -335,6 +344,7 @@ public interface ReactiveGeoCommands {
|
||||
* {@code GEOHASH} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/geohash">Redis Documentation: GEOHASH</a>
|
||||
*/
|
||||
class GeoHashCommand extends KeyCommand {
|
||||
|
||||
@@ -400,6 +410,7 @@ public interface ReactiveGeoCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param member must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/geohash">Redis Documentation: GEOHASH</a>
|
||||
*/
|
||||
default Mono<String> geoHash(ByteBuffer key, ByteBuffer member) {
|
||||
|
||||
@@ -415,6 +426,7 @@ public interface ReactiveGeoCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param members must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/geohash">Redis Documentation: GEOHASH</a>
|
||||
*/
|
||||
default Mono<List<String>> geoHash(ByteBuffer key, Collection<ByteBuffer> members) {
|
||||
|
||||
@@ -431,6 +443,7 @@ public interface ReactiveGeoCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/geohash">Redis Documentation: GEOHASH</a>
|
||||
*/
|
||||
Flux<MultiValueResponse<GeoHashCommand, String>> geoHash(Publisher<GeoHashCommand> commands);
|
||||
|
||||
@@ -438,6 +451,7 @@ public interface ReactiveGeoCommands {
|
||||
* {@code GEOPOS} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/geopos">Redis Documentation: GEOPOS</a>
|
||||
*/
|
||||
class GeoPosCommand extends KeyCommand {
|
||||
|
||||
@@ -503,6 +517,7 @@ public interface ReactiveGeoCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param member must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/geopos">Redis Documentation: GEOPOS</a>
|
||||
*/
|
||||
default Mono<Point> geoPos(ByteBuffer key, ByteBuffer member) {
|
||||
|
||||
@@ -517,6 +532,7 @@ public interface ReactiveGeoCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param members must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/geopos">Redis Documentation: GEOPOS</a>
|
||||
*/
|
||||
default Mono<List<Point>> geoPos(ByteBuffer key, Collection<ByteBuffer> members) {
|
||||
|
||||
@@ -531,6 +547,7 @@ public interface ReactiveGeoCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/geopos">Redis Documentation: GEOPOS</a>
|
||||
*/
|
||||
Flux<MultiValueResponse<GeoPosCommand, Point>> geoPos(Publisher<GeoPosCommand> commands);
|
||||
|
||||
@@ -538,6 +555,7 @@ public interface ReactiveGeoCommands {
|
||||
* {@code GEORADIUS} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/georadius">Redis Documentation: GEORADIUS</a>
|
||||
*/
|
||||
class GeoRadiusCommand extends KeyCommand {
|
||||
|
||||
@@ -838,6 +856,7 @@ public interface ReactiveGeoCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param circle must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/georadius">Redis Documentation: GEORADIUS</a>
|
||||
*/
|
||||
default Mono<List<GeoLocation<ByteBuffer>>> geoRadius(ByteBuffer key, Circle circle) {
|
||||
return geoRadius(key, circle, null)
|
||||
@@ -851,6 +870,7 @@ public interface ReactiveGeoCommands {
|
||||
* @param circle must not be {@literal null}.
|
||||
* @param geoRadiusArgs can be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/georadius">Redis Documentation: GEORADIUS</a>
|
||||
*/
|
||||
default Mono<GeoResults<GeoLocation<ByteBuffer>>> geoRadius(ByteBuffer key, Circle circle,
|
||||
GeoRadiusCommandArgs geoRadiusArgs) {
|
||||
@@ -867,6 +887,7 @@ public interface ReactiveGeoCommands {
|
||||
*
|
||||
* @param commands
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/georadius">Redis Documentation: GEORADIUS</a>
|
||||
*/
|
||||
Flux<CommandResponse<GeoRadiusCommand, GeoResults<GeoLocation<ByteBuffer>>>> geoRadius(
|
||||
Publisher<GeoRadiusCommand> commands);
|
||||
@@ -875,6 +896,7 @@ public interface ReactiveGeoCommands {
|
||||
* {@code GEORADIUSBYMEMBER} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/georadiusbymember">Redis Documentation: GEORADIUSBYMEMBER</a>
|
||||
*/
|
||||
class GeoRadiusByMemberCommand extends KeyCommand {
|
||||
|
||||
@@ -1159,6 +1181,7 @@ public interface ReactiveGeoCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param member must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/georadiusbymember">Redis Documentation: GEORADIUSBYMEMBER</a>
|
||||
*/
|
||||
default Mono<List<GeoLocation<ByteBuffer>>> geoRadiusByMember(ByteBuffer key, ByteBuffer member, Distance distance) {
|
||||
return geoRadiusByMember(key, member, distance, null)
|
||||
@@ -1172,6 +1195,7 @@ public interface ReactiveGeoCommands {
|
||||
* @param member must not be {@literal null}.
|
||||
* @param geoRadiusArgs can be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/georadiusbymember">Redis Documentation: GEORADIUSBYMEMBER</a>
|
||||
*/
|
||||
default Mono<GeoResults<GeoLocation<ByteBuffer>>> geoRadiusByMember(ByteBuffer key, ByteBuffer member,
|
||||
Distance distance, GeoRadiusCommandArgs geoRadiusArgs) {
|
||||
@@ -1190,6 +1214,7 @@ public interface ReactiveGeoCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/georadiusbymember">Redis Documentation: GEORADIUSBYMEMBER</a>
|
||||
*/
|
||||
Flux<CommandResponse<GeoRadiusByMemberCommand, GeoResults<GeoLocation<ByteBuffer>>>> geoRadiusByMember(
|
||||
Publisher<GeoRadiusByMemberCommand> commands);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,9 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -32,9 +35,6 @@ import org.springframework.data.redis.connection.ReactiveRedisConnection.MultiVa
|
||||
import org.springframework.data.redis.connection.ReactiveRedisConnection.NumericResponse;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* Redis Hash commands executed using reactive infrastructure.
|
||||
*
|
||||
@@ -48,6 +48,7 @@ public interface ReactiveHashCommands {
|
||||
* {@literal HSET} {@link Command}.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/hset">Redis Documentation: HSET</a>
|
||||
*/
|
||||
class HSetCommand extends KeyCommand {
|
||||
|
||||
@@ -150,6 +151,7 @@ public interface ReactiveHashCommands {
|
||||
* @param field must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hset">Redis Documentation: HSET</a>
|
||||
*/
|
||||
default Mono<Boolean> hSet(ByteBuffer key, ByteBuffer field, ByteBuffer value) {
|
||||
|
||||
@@ -167,6 +169,7 @@ public interface ReactiveHashCommands {
|
||||
* @param field must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hsetnx">Redis Documentation: HSETNX</a>
|
||||
*/
|
||||
default Mono<Boolean> hSetNX(ByteBuffer key, ByteBuffer field, ByteBuffer value) {
|
||||
|
||||
@@ -184,6 +187,7 @@ public interface ReactiveHashCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param fieldValueMap must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hmset">Redis Documentation: HMSET</a>
|
||||
*/
|
||||
default Mono<Boolean> hMSet(ByteBuffer key, Map<ByteBuffer, ByteBuffer> fieldValueMap) {
|
||||
|
||||
@@ -199,6 +203,7 @@ public interface ReactiveHashCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hset">Redis Documentation: HSET</a>
|
||||
*/
|
||||
Flux<BooleanResponse<HSetCommand>> hSet(Publisher<HSetCommand> commands);
|
||||
|
||||
@@ -206,6 +211,7 @@ public interface ReactiveHashCommands {
|
||||
* {@literal HGET} {@link Command}.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/hget">Redis Documentation: HGET</a>
|
||||
*/
|
||||
class HGetCommand extends KeyCommand {
|
||||
|
||||
@@ -271,6 +277,7 @@ public interface ReactiveHashCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param field must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hget">Redis Documentation: HGET</a>
|
||||
*/
|
||||
default Mono<ByteBuffer> hGet(ByteBuffer key, ByteBuffer field) {
|
||||
return hMGet(key, Collections.singletonList(field)).map(val -> val.isEmpty() ? null : val.iterator().next());
|
||||
@@ -282,6 +289,7 @@ public interface ReactiveHashCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param fields must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hmget">Redis Documentation: HMGET</a>
|
||||
*/
|
||||
default Mono<List<ByteBuffer>> hMGet(ByteBuffer key, Collection<ByteBuffer> fields) {
|
||||
|
||||
@@ -296,6 +304,7 @@ public interface ReactiveHashCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hmget">Redis Documentation: HMGET</a>
|
||||
*/
|
||||
Flux<MultiValueResponse<HGetCommand, ByteBuffer>> hMGet(Publisher<HGetCommand> commands);
|
||||
|
||||
@@ -303,6 +312,7 @@ public interface ReactiveHashCommands {
|
||||
* {@literal HEXISTS} {@link Command}.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/hexists">Redis Documentation: HEXISTS</a>
|
||||
*/
|
||||
class HExistsCommand extends KeyCommand {
|
||||
|
||||
@@ -355,6 +365,7 @@ public interface ReactiveHashCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param field must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hexists">Redis Documentation: HEXISTS</a>
|
||||
*/
|
||||
default Mono<Boolean> hExists(ByteBuffer key, ByteBuffer field) {
|
||||
|
||||
@@ -369,11 +380,13 @@ public interface ReactiveHashCommands {
|
||||
*
|
||||
* @param commands
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hexists">Redis Documentation: HEXISTS</a>
|
||||
*/
|
||||
Flux<BooleanResponse<HExistsCommand>> hExists(Publisher<HExistsCommand> commands);
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/hdel">Redis Documentation: HDEL</a>
|
||||
*/
|
||||
class HDelCommand extends KeyCommand {
|
||||
|
||||
@@ -439,6 +452,7 @@ public interface ReactiveHashCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param field must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hdel">Redis Documentation: HDEL</a>
|
||||
*/
|
||||
default Mono<Boolean> hDel(ByteBuffer key, ByteBuffer field) {
|
||||
|
||||
@@ -453,6 +467,7 @@ public interface ReactiveHashCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param fields must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hdel">Redis Documentation: HDEL</a>
|
||||
*/
|
||||
default Mono<Long> hDel(ByteBuffer key, Collection<ByteBuffer> fields) {
|
||||
|
||||
@@ -467,6 +482,7 @@ public interface ReactiveHashCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hdel">Redis Documentation: HDEL</a>
|
||||
*/
|
||||
Flux<NumericResponse<HDelCommand, Long>> hDel(Publisher<HDelCommand> commands);
|
||||
|
||||
@@ -475,6 +491,7 @@ public interface ReactiveHashCommands {
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hlen">Redis Documentation: HLEN</a>
|
||||
*/
|
||||
default Mono<Long> hLen(ByteBuffer key) {
|
||||
|
||||
@@ -488,6 +505,7 @@ public interface ReactiveHashCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hlen">Redis Documentation: HLEN</a>
|
||||
*/
|
||||
Flux<NumericResponse<KeyCommand, Long>> hLen(Publisher<KeyCommand> commands);
|
||||
|
||||
@@ -496,6 +514,7 @@ public interface ReactiveHashCommands {
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hkeys">Redis Documentation: HKEYS</a>
|
||||
*/
|
||||
default Mono<List<ByteBuffer>> hKeys(ByteBuffer key) {
|
||||
|
||||
@@ -509,6 +528,7 @@ public interface ReactiveHashCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hkeys">Redis Documentation: HKEYS</a>
|
||||
*/
|
||||
Flux<MultiValueResponse<KeyCommand, ByteBuffer>> hKeys(Publisher<KeyCommand> commands);
|
||||
|
||||
@@ -517,6 +537,7 @@ public interface ReactiveHashCommands {
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hvals">Redis Documentation: HVALS</a>
|
||||
*/
|
||||
default Mono<List<ByteBuffer>> hVals(ByteBuffer key) {
|
||||
|
||||
@@ -530,6 +551,7 @@ public interface ReactiveHashCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hvals">Redis Documentation: HVALS</a>
|
||||
*/
|
||||
Flux<MultiValueResponse<KeyCommand, ByteBuffer>> hVals(Publisher<KeyCommand> commands);
|
||||
|
||||
@@ -538,6 +560,7 @@ public interface ReactiveHashCommands {
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hgetall">Redis Documentation: HGETALL</a>
|
||||
*/
|
||||
default Mono<Map<ByteBuffer, ByteBuffer>> hGetAll(ByteBuffer key) {
|
||||
|
||||
@@ -551,6 +574,7 @@ public interface ReactiveHashCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hgetall">Redis Documentation: HGETALL</a>
|
||||
*/
|
||||
Flux<CommandResponse<KeyCommand, Map<ByteBuffer, ByteBuffer>>> hGetAll(Publisher<KeyCommand> commands);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,9 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -28,9 +31,6 @@ import org.springframework.data.redis.connection.ReactiveRedisConnection.KeyComm
|
||||
import org.springframework.data.redis.connection.ReactiveRedisConnection.NumericResponse;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* Redis HyperLogLog commands executed using reactive infrastructure.
|
||||
*
|
||||
@@ -44,6 +44,7 @@ public interface ReactiveHyperLogLogCommands {
|
||||
* {@code PFADD} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/pfadd">Redis Documentation: PFADD</a>
|
||||
*/
|
||||
class PfAddCommand extends KeyCommand {
|
||||
|
||||
@@ -108,6 +109,7 @@ public interface ReactiveHyperLogLogCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/pfadd">Redis Documentation: PFADD</a>
|
||||
*/
|
||||
default Mono<Long> pfAdd(ByteBuffer key, ByteBuffer value) {
|
||||
|
||||
@@ -122,6 +124,7 @@ public interface ReactiveHyperLogLogCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param values must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/pfadd">Redis Documentation: PFADD</a>
|
||||
*/
|
||||
default Mono<Long> pfAdd(ByteBuffer key, Collection<ByteBuffer> values) {
|
||||
|
||||
@@ -136,6 +139,7 @@ public interface ReactiveHyperLogLogCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/pfadd">Redis Documentation: PFADD</a>
|
||||
*/
|
||||
Flux<NumericResponse<PfAddCommand, Long>> pfAdd(Publisher<PfAddCommand> commands);
|
||||
|
||||
@@ -143,6 +147,7 @@ public interface ReactiveHyperLogLogCommands {
|
||||
* {@code PFCOUNT} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/pfcount">Redis Documentation: PFCOUNT</a>
|
||||
*/
|
||||
class PfCountCommand implements Command {
|
||||
|
||||
@@ -201,6 +206,7 @@ public interface ReactiveHyperLogLogCommands {
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/pfcount">Redis Documentation: PFCOUNT</a>
|
||||
*/
|
||||
default Mono<Long> pfCount(ByteBuffer key) {
|
||||
|
||||
@@ -214,6 +220,7 @@ public interface ReactiveHyperLogLogCommands {
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/pfcount">Redis Documentation: PFCOUNT</a>
|
||||
*/
|
||||
default Mono<Long> pfCount(Collection<ByteBuffer> keys) {
|
||||
|
||||
@@ -227,6 +234,7 @@ public interface ReactiveHyperLogLogCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/pfcount">Redis Documentation: PFCOUNT</a>
|
||||
*/
|
||||
Flux<NumericResponse<PfCountCommand, Long>> pfCount(Publisher<PfCountCommand> commands);
|
||||
|
||||
@@ -234,6 +242,7 @@ public interface ReactiveHyperLogLogCommands {
|
||||
* {@code PFMERGE} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/pfmerge">Redis Documentation: PFMERGE</a>
|
||||
*/
|
||||
class PfMergeCommand extends KeyCommand {
|
||||
|
||||
@@ -286,6 +295,7 @@ public interface ReactiveHyperLogLogCommands {
|
||||
* @param destinationKey must not be {@literal null}.
|
||||
* @param sourceKeys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/pfmerge">Redis Documentation: PFMERGE</a>
|
||||
*/
|
||||
default Mono<Boolean> pfMerge(ByteBuffer destinationKey, Collection<ByteBuffer> sourceKeys) {
|
||||
|
||||
@@ -301,6 +311,7 @@ public interface ReactiveHyperLogLogCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/pfmerge">Redis Documentation: PFMERGE</a>
|
||||
*/
|
||||
Flux<BooleanResponse<PfMergeCommand>> pfMerge(Publisher<PfMergeCommand> commands);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,9 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.List;
|
||||
|
||||
@@ -26,9 +29,6 @@ import org.springframework.data.redis.connection.ReactiveRedisConnection.MultiVa
|
||||
import org.springframework.data.redis.connection.ReactiveRedisConnection.NumericResponse;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* Redis Key commands executed using reactive infrastructure.
|
||||
*
|
||||
@@ -43,6 +43,7 @@ public interface ReactiveKeyCommands {
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/exists">Redis Documentation: EXISTS</a>
|
||||
*/
|
||||
default Mono<Boolean> exists(ByteBuffer key) {
|
||||
|
||||
@@ -56,6 +57,7 @@ public interface ReactiveKeyCommands {
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/exists">Redis Documentation: EXISTS</a>
|
||||
*/
|
||||
Flux<BooleanResponse<KeyCommand>> exists(Publisher<KeyCommand> keys);
|
||||
|
||||
@@ -64,6 +66,7 @@ public interface ReactiveKeyCommands {
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/type">Redis Documentation: TYPE</a>
|
||||
*/
|
||||
default Mono<DataType> type(ByteBuffer key) {
|
||||
|
||||
@@ -77,6 +80,7 @@ public interface ReactiveKeyCommands {
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/type">Redis Documentation: TYPE</a>
|
||||
*/
|
||||
Flux<CommandResponse<KeyCommand, DataType>> type(Publisher<KeyCommand> keys);
|
||||
|
||||
@@ -85,6 +89,7 @@ public interface ReactiveKeyCommands {
|
||||
*
|
||||
* @param pattern must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/keys">Redis Documentation: KEYS</a>
|
||||
*/
|
||||
default Mono<List<ByteBuffer>> keys(ByteBuffer pattern) {
|
||||
|
||||
@@ -93,25 +98,28 @@ public interface ReactiveKeyCommands {
|
||||
return keys(Mono.just(pattern)).next().map(MultiValueResponse::getOutput);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a random key from the keyspace.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Mono<ByteBuffer> randomKey();
|
||||
|
||||
/**
|
||||
* Find all keys matching the given {@literal pattern}.
|
||||
*
|
||||
* @param patterns must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/keys">Redis Documentation: KEYS</a>
|
||||
*/
|
||||
Flux<MultiValueResponse<ByteBuffer, ByteBuffer>> keys(Publisher<ByteBuffer> patterns);
|
||||
|
||||
/**
|
||||
* Return a random key from the keyspace.
|
||||
*
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/randomkey">Redis Documentation: RANDOMKEY</a>
|
||||
*/
|
||||
Mono<ByteBuffer> randomKey();
|
||||
|
||||
/**
|
||||
* {@code RENAME} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/rename">Redis Documentation: RENAME</a>
|
||||
*/
|
||||
class RenameCommand extends KeyCommand {
|
||||
|
||||
@@ -164,6 +172,7 @@ public interface ReactiveKeyCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param newName must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/rename">Redis Documentation: RENAME</a>
|
||||
*/
|
||||
default Mono<Boolean> rename(ByteBuffer key, ByteBuffer newName) {
|
||||
|
||||
@@ -172,7 +181,14 @@ public interface ReactiveKeyCommands {
|
||||
return rename(Mono.just(RenameCommand.key(key).to(newName))).next().map(BooleanResponse::getOutput);
|
||||
}
|
||||
|
||||
Flux<BooleanResponse<RenameCommand>> rename(Publisher<RenameCommand> cmd);
|
||||
/**
|
||||
* Rename key {@literal oleName} to {@literal newName}.
|
||||
*
|
||||
* @param command must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/rename">Redis Documentation: RENAME</a>
|
||||
*/
|
||||
Flux<BooleanResponse<RenameCommand>> rename(Publisher<RenameCommand> command);
|
||||
|
||||
/**
|
||||
* Rename key {@literal oleName} to {@literal newName} only if {@literal newName} does not exist.
|
||||
@@ -180,6 +196,7 @@ public interface ReactiveKeyCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param newName must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/renamenx">Redis Documentation: RENAMENX</a>
|
||||
*/
|
||||
default Mono<Boolean> renameNX(ByteBuffer key, ByteBuffer newName) {
|
||||
|
||||
@@ -193,6 +210,7 @@ public interface ReactiveKeyCommands {
|
||||
*
|
||||
* @param command must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/renamenx">Redis Documentation: RENAMENX</a>
|
||||
*/
|
||||
Flux<BooleanResponse<RenameCommand>> renameNX(Publisher<RenameCommand> command);
|
||||
|
||||
@@ -201,6 +219,7 @@ public interface ReactiveKeyCommands {
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/del">Redis Documentation: DEL</a>
|
||||
*/
|
||||
default Mono<Long> del(ByteBuffer key) {
|
||||
|
||||
@@ -214,6 +233,7 @@ public interface ReactiveKeyCommands {
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return {@link Flux} of {@link NumericResponse} holding the {@literal key} removed along with the deletion result.
|
||||
* @see <a href="http://redis.io/commands/del">Redis Documentation: DEL</a>
|
||||
*/
|
||||
Flux<NumericResponse<KeyCommand, Long>> del(Publisher<KeyCommand> keys);
|
||||
|
||||
@@ -222,6 +242,7 @@ public interface ReactiveKeyCommands {
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/del">Redis Documentation: DEL</a>
|
||||
*/
|
||||
default Mono<Long> mDel(List<ByteBuffer> keys) {
|
||||
|
||||
@@ -235,6 +256,7 @@ public interface ReactiveKeyCommands {
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return {@link Flux} of {@link NumericResponse} holding the {@literal keys} removed along with the deletion result.
|
||||
* @see <a href="http://redis.io/commands/del">Redis Documentation: DEL</a>
|
||||
*/
|
||||
Flux<NumericResponse<List<ByteBuffer>, Long>> mDel(Publisher<List<ByteBuffer>> keys);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,9 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
@@ -34,9 +37,6 @@ import org.springframework.data.redis.connection.RedisListCommands.Position;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* Redis List commands executed using reactive infrastructure.
|
||||
*
|
||||
@@ -57,6 +57,8 @@ public interface ReactiveListCommands {
|
||||
* {@code LPUSH}/{@literal RPUSH} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/lpush">Redis Documentation: LPUSH</a>
|
||||
* @see <a href="http://redis.io/commands/rpush">Redis Documentation: RPUSH</a>
|
||||
*/
|
||||
class PushCommand extends KeyCommand {
|
||||
|
||||
@@ -167,6 +169,7 @@ public interface ReactiveListCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param values must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/rpush">Redis Documentation: RPUSH</a>
|
||||
*/
|
||||
default Mono<Long> rPush(ByteBuffer key, List<ByteBuffer> values) {
|
||||
|
||||
@@ -182,6 +185,7 @@ public interface ReactiveListCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/rpushx">Redis Documentation: RPUSHX</a>
|
||||
*/
|
||||
default Mono<Long> rPushX(ByteBuffer key, ByteBuffer value) {
|
||||
|
||||
@@ -197,6 +201,7 @@ public interface ReactiveListCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param values must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lpush">Redis Documentation: LPUSH</a>
|
||||
*/
|
||||
default Mono<Long> lPush(ByteBuffer key, List<ByteBuffer> values) {
|
||||
|
||||
@@ -212,6 +217,7 @@ public interface ReactiveListCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lpushx">Redis Documentation: LPUSHX</a>
|
||||
*/
|
||||
default Mono<Long> lPushX(ByteBuffer key, ByteBuffer value) {
|
||||
|
||||
@@ -226,6 +232,8 @@ public interface ReactiveListCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lpush">Redis Documentation: LPUSH</a>
|
||||
* @see <a href="http://redis.io/commands/rpush">Redis Documentation: RPUSH</a>
|
||||
*/
|
||||
Flux<NumericResponse<PushCommand, Long>> push(Publisher<PushCommand> commands);
|
||||
|
||||
@@ -234,6 +242,7 @@ public interface ReactiveListCommands {
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/llen">Redis Documentation: LLEN</a>
|
||||
*/
|
||||
default Mono<Long> lLen(ByteBuffer key) {
|
||||
|
||||
@@ -247,6 +256,7 @@ public interface ReactiveListCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/llen">Redis Documentation: LLEN</a>
|
||||
*/
|
||||
Flux<NumericResponse<KeyCommand, Long>> lLen(Publisher<KeyCommand> commands);
|
||||
|
||||
@@ -257,6 +267,7 @@ public interface ReactiveListCommands {
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lrange">Redis Documentation: LRANGE</a>
|
||||
*/
|
||||
default Mono<List<ByteBuffer>> lRange(ByteBuffer key, long start, long end) {
|
||||
|
||||
@@ -271,6 +282,7 @@ public interface ReactiveListCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lrange">Redis Documentation: LRANGE</a>
|
||||
*/
|
||||
Flux<MultiValueResponse<RangeCommand, ByteBuffer>> lRange(Publisher<RangeCommand> commands);
|
||||
|
||||
@@ -281,6 +293,7 @@ public interface ReactiveListCommands {
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/ltrim">Redis Documentation: LTRIM</a>
|
||||
*/
|
||||
default Mono<Boolean> lTrim(ByteBuffer key, long start, long end) {
|
||||
|
||||
@@ -296,6 +309,7 @@ public interface ReactiveListCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/ltrim">Redis Documentation: LTRIM</a>
|
||||
*/
|
||||
Flux<BooleanResponse<RangeCommand>> lTrim(Publisher<RangeCommand> commands);
|
||||
|
||||
@@ -303,6 +317,7 @@ public interface ReactiveListCommands {
|
||||
* {@code LINDEX} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/lindex">Redis Documentation: LINDEX</a>
|
||||
*/
|
||||
class LIndexCommand extends KeyCommand {
|
||||
|
||||
@@ -351,6 +366,7 @@ public interface ReactiveListCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param index
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lindex">Redis Documentation: LINDEX</a>
|
||||
*/
|
||||
default Mono<ByteBuffer> lIndex(ByteBuffer key, long index) {
|
||||
|
||||
@@ -364,6 +380,7 @@ public interface ReactiveListCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lindex">Redis Documentation: LINDEX</a>
|
||||
*/
|
||||
Flux<ByteBufferResponse<LIndexCommand>> lIndex(Publisher<LIndexCommand> commands);
|
||||
|
||||
@@ -371,6 +388,7 @@ public interface ReactiveListCommands {
|
||||
* {@code LINSERT} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/linsert">Redis Documentation: LINSERT</a>
|
||||
*/
|
||||
class LInsertCommand extends KeyCommand {
|
||||
|
||||
@@ -470,6 +488,7 @@ public interface ReactiveListCommands {
|
||||
* @param pivot must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/linsert">Redis Documentation: LINSERT</a>
|
||||
*/
|
||||
default Mono<Long> lInsert(ByteBuffer key, Position position, ByteBuffer pivot, ByteBuffer value) {
|
||||
|
||||
@@ -490,6 +509,7 @@ public interface ReactiveListCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/linsert">Redis Documentation: LINSERT</a>
|
||||
*/
|
||||
Flux<NumericResponse<LInsertCommand, Long>> lInsert(Publisher<LInsertCommand> commands);
|
||||
|
||||
@@ -497,6 +517,7 @@ public interface ReactiveListCommands {
|
||||
* {@code LSET} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/lset">Redis Documentation: LSET</a>
|
||||
*/
|
||||
class LSetCommand extends KeyCommand {
|
||||
|
||||
@@ -568,6 +589,7 @@ public interface ReactiveListCommands {
|
||||
* @param index
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lset">Redis Documentation: LSET</a>
|
||||
*/
|
||||
default Mono<Boolean> lSet(ByteBuffer key, long index, ByteBuffer value) {
|
||||
|
||||
@@ -582,6 +604,7 @@ public interface ReactiveListCommands {
|
||||
*
|
||||
* @param commands
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lset">Redis Documentation: LSET</a>
|
||||
*/
|
||||
Flux<BooleanResponse<LSetCommand>> lSet(Publisher<LSetCommand> commands);
|
||||
|
||||
@@ -589,6 +612,7 @@ public interface ReactiveListCommands {
|
||||
* {@code LREM} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/lrem">Redis Documentation: LREM</a>
|
||||
*/
|
||||
class LRemCommand extends KeyCommand {
|
||||
|
||||
@@ -679,6 +703,7 @@ public interface ReactiveListCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lrem">Redis Documentation: LREM</a>
|
||||
*/
|
||||
default Mono<Long> lRem(ByteBuffer key, ByteBuffer value) {
|
||||
|
||||
@@ -695,6 +720,7 @@ public interface ReactiveListCommands {
|
||||
* @param count must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lrem">Redis Documentation: LREM</a>
|
||||
*/
|
||||
default Mono<Long> lRem(ByteBuffer key, Long count, ByteBuffer value) {
|
||||
|
||||
@@ -712,6 +738,7 @@ public interface ReactiveListCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lrem">Redis Documentation: LREM</a>
|
||||
*/
|
||||
Flux<NumericResponse<LRemCommand, Long>> lRem(Publisher<LRemCommand> commands);
|
||||
|
||||
@@ -719,6 +746,8 @@ public interface ReactiveListCommands {
|
||||
* {@code LPOP}/{@literal RPOP} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/lpop">Redis Documentation: LPOP</a>
|
||||
* @see <a href="http://redis.io/commands/rpop">Redis Documentation: RPOP</a>
|
||||
*/
|
||||
class PopCommand extends KeyCommand {
|
||||
|
||||
@@ -775,6 +804,7 @@ public interface ReactiveListCommands {
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lpop">Redis Documentation: LPOP</a>
|
||||
*/
|
||||
default Mono<ByteBuffer> lPop(ByteBuffer key) {
|
||||
|
||||
@@ -788,6 +818,7 @@ public interface ReactiveListCommands {
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/rpop">Redis Documentation: RPOP</a>
|
||||
*/
|
||||
default Mono<ByteBuffer> rPop(ByteBuffer key) {
|
||||
|
||||
@@ -801,11 +832,15 @@ public interface ReactiveListCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lpop">Redis Documentation: LPOP</a>
|
||||
* @see <a href="http://redis.io/commands/rpop">Redis Documentation: RPOP</a>
|
||||
*/
|
||||
Flux<ByteBufferResponse<PopCommand>> pop(Publisher<PopCommand> commands);
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/blpop">Redis Documentation: BLPOP</a>
|
||||
* @see <a href="http://redis.io/commands/brpop">Redis Documentation: BRPOP</a>
|
||||
*/
|
||||
class BPopCommand implements Command {
|
||||
|
||||
@@ -939,6 +974,7 @@ public interface ReactiveListCommands {
|
||||
* @param keys must not be {@literal null}.
|
||||
* @param timeout must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/blpop">Redis Documentation: BLPOP</a>
|
||||
*/
|
||||
default Mono<PopResult> blPop(List<ByteBuffer> keys, Duration timeout) {
|
||||
|
||||
@@ -955,6 +991,7 @@ public interface ReactiveListCommands {
|
||||
* @param keys must not be {@literal null}.
|
||||
* @param timeout must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/brpop">Redis Documentation: BRPOP</a>
|
||||
*/
|
||||
default Mono<PopResult> brPop(List<ByteBuffer> keys, Duration timeout) {
|
||||
|
||||
@@ -971,6 +1008,8 @@ public interface ReactiveListCommands {
|
||||
*
|
||||
* @param commands
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/blpop">Redis Documentation: BLPOP</a>
|
||||
* @see <a href="http://redis.io/commands/brpop">Redis Documentation: BRPOP</a>
|
||||
*/
|
||||
Flux<PopResponse> bPop(Publisher<BPopCommand> commands);
|
||||
|
||||
@@ -978,6 +1017,7 @@ public interface ReactiveListCommands {
|
||||
* {@code RPOPLPUSH} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/rpoplpush">Redis Documentation: RPOPLPUSH</a>
|
||||
*/
|
||||
class RPopLPushCommand extends KeyCommand {
|
||||
|
||||
@@ -1030,6 +1070,7 @@ public interface ReactiveListCommands {
|
||||
* @param source must not be {@literal null}.
|
||||
* @param destination must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/rpoplpush">Redis Documentation: RPOPLPUSH</a>
|
||||
*/
|
||||
default Mono<ByteBuffer> rPopLPush(ByteBuffer source, ByteBuffer destination) {
|
||||
|
||||
@@ -1047,6 +1088,7 @@ public interface ReactiveListCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/rpoplpush">Redis Documentation: RPOPLPUSH</a>
|
||||
*/
|
||||
Flux<ByteBufferResponse<RPopLPushCommand>> rPopLPush(Publisher<RPopLPushCommand> commands);
|
||||
|
||||
@@ -1054,6 +1096,7 @@ public interface ReactiveListCommands {
|
||||
* {@code BRPOPLPUSH} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/brpoplpush">Redis Documentation: BRPOPLPUSH</a>
|
||||
*/
|
||||
class BRPopLPushCommand extends KeyCommand {
|
||||
|
||||
@@ -1130,6 +1173,7 @@ public interface ReactiveListCommands {
|
||||
* @param source must not be {@literal null}.
|
||||
* @param destination must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/brpoplpush">Redis Documentation: BRPOPLPUSH</a>
|
||||
*/
|
||||
default Mono<ByteBuffer> bRPopLPush(ByteBuffer source, ByteBuffer destination, Duration timeout) {
|
||||
|
||||
@@ -1147,6 +1191,7 @@ public interface ReactiveListCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/brpoplpush">Redis Documentation: BRPOPLPUSH</a>
|
||||
*/
|
||||
Flux<ByteBufferResponse<BRPopLPushCommand>> bRPopLPush(Publisher<BRPopLPushCommand> commands);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,9 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
@@ -22,9 +25,6 @@ import org.springframework.data.redis.connection.ReactiveRedisConnection.KeyComm
|
||||
import org.springframework.data.redis.connection.ReactiveRedisConnection.NumericResponse;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* Redis numeric commands executed using reactive infrastructure.
|
||||
*
|
||||
@@ -39,6 +39,7 @@ public interface ReactiveNumberCommands {
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/incr">Redis Documentation: INCR</a>
|
||||
*/
|
||||
default Mono<Long> incr(ByteBuffer key) {
|
||||
|
||||
@@ -52,6 +53,7 @@ public interface ReactiveNumberCommands {
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/incr">Redis Documentation: INCR</a>
|
||||
*/
|
||||
Flux<NumericResponse<KeyCommand, Long>> incr(Publisher<KeyCommand> keys);
|
||||
|
||||
@@ -59,6 +61,7 @@ public interface ReactiveNumberCommands {
|
||||
* {@code INCRBY} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/incrby">Redis Documentation: INCRBY</a>
|
||||
*/
|
||||
class IncrByCommand<T extends Number> extends KeyCommand {
|
||||
|
||||
@@ -110,6 +113,7 @@ public interface ReactiveNumberCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/incrby">Redis Documentation: INCRBY</a>
|
||||
*/
|
||||
default <T extends Number> Mono<T> incrBy(ByteBuffer key, T value) {
|
||||
|
||||
@@ -124,6 +128,7 @@ public interface ReactiveNumberCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/incrby">Redis Documentation: INCRBY</a>
|
||||
*/
|
||||
<T extends Number> Flux<NumericResponse<ReactiveNumberCommands.IncrByCommand<T>, T>> incrBy(
|
||||
Publisher<ReactiveNumberCommands.IncrByCommand<T>> commands);
|
||||
@@ -132,6 +137,7 @@ public interface ReactiveNumberCommands {
|
||||
* {@code DECRBY} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/decrby">Redis Documentation: DECRBY</a>
|
||||
*/
|
||||
class DecrByCommand<T extends Number> extends KeyCommand {
|
||||
|
||||
@@ -182,6 +188,7 @@ public interface ReactiveNumberCommands {
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/decr">Redis Documentation: DECR</a>
|
||||
*/
|
||||
default Mono<Long> decr(ByteBuffer key) {
|
||||
|
||||
@@ -195,6 +202,7 @@ public interface ReactiveNumberCommands {
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/decr">Redis Documentation: DECR</a>
|
||||
*/
|
||||
Flux<NumericResponse<KeyCommand, Long>> decr(Publisher<KeyCommand> keys);
|
||||
|
||||
@@ -204,6 +212,7 @@ public interface ReactiveNumberCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/decrby">Redis Documentation: DECRBY</a>
|
||||
*/
|
||||
default <T extends Number> Mono<T> decrBy(ByteBuffer key, T value) {
|
||||
|
||||
@@ -225,6 +234,7 @@ public interface ReactiveNumberCommands {
|
||||
* {@code HINCRBY} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/hincrby">Redis Documentation: HINCRBY</a>
|
||||
*/
|
||||
class HIncrByCommand<T extends Number> extends KeyCommand {
|
||||
|
||||
@@ -301,6 +311,7 @@ public interface ReactiveNumberCommands {
|
||||
* @param field must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hincrby">Redis Documentation: HINCRBY</a>
|
||||
*/
|
||||
default <T extends Number> Mono<T> hIncrBy(ByteBuffer key, ByteBuffer field, T value) {
|
||||
|
||||
@@ -316,6 +327,7 @@ public interface ReactiveNumberCommands {
|
||||
* Increment {@literal value} of a hash {@literal field} by the given {@literal value}.
|
||||
*
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hincrby">Redis Documentation: HINCRBY</a>
|
||||
*/
|
||||
<T extends Number> Flux<NumericResponse<HIncrByCommand<T>, T>> hIncrBy(Publisher<HIncrByCommand<T>> commands);
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.redis.connection;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,9 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -31,9 +34,6 @@ import org.springframework.data.redis.connection.ReactiveRedisConnection.MultiVa
|
||||
import org.springframework.data.redis.connection.ReactiveRedisConnection.NumericResponse;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* Redis Set commands executed using reactive infrastructure.
|
||||
*
|
||||
@@ -47,6 +47,7 @@ public interface ReactiveSetCommands {
|
||||
* {@code SADD} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/sadd">Redis Documentation: SADD</a>
|
||||
*/
|
||||
class SAddCommand extends KeyCommand {
|
||||
|
||||
@@ -112,6 +113,7 @@ public interface ReactiveSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sadd">Redis Documentation: SADD</a>
|
||||
*/
|
||||
default Mono<Long> sAdd(ByteBuffer key, ByteBuffer value) {
|
||||
|
||||
@@ -126,6 +128,7 @@ public interface ReactiveSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param values must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sadd">Redis Documentation: SADD</a>
|
||||
*/
|
||||
default Mono<Long> sAdd(ByteBuffer key, Collection<ByteBuffer> values) {
|
||||
|
||||
@@ -140,6 +143,7 @@ public interface ReactiveSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sadd">Redis Documentation: SADD</a>
|
||||
*/
|
||||
Flux<NumericResponse<SAddCommand, Long>> sAdd(Publisher<SAddCommand> commands);
|
||||
|
||||
@@ -147,6 +151,7 @@ public interface ReactiveSetCommands {
|
||||
* {@code SREM} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/srem">Redis Documentation: SREM</a>
|
||||
*/
|
||||
class SRemCommand extends KeyCommand {
|
||||
|
||||
@@ -212,6 +217,7 @@ public interface ReactiveSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/srem">Redis Documentation: SREM</a>
|
||||
*/
|
||||
default Mono<Long> sRem(ByteBuffer key, ByteBuffer value) {
|
||||
|
||||
@@ -226,6 +232,7 @@ public interface ReactiveSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param values must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/srem">Redis Documentation: SREM</a>
|
||||
*/
|
||||
default Mono<Long> sRem(ByteBuffer key, Collection<ByteBuffer> values) {
|
||||
|
||||
@@ -240,6 +247,7 @@ public interface ReactiveSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/srem">Redis Documentation: SREM</a>
|
||||
*/
|
||||
Flux<NumericResponse<SRemCommand, Long>> sRem(Publisher<SRemCommand> commands);
|
||||
|
||||
@@ -248,6 +256,7 @@ public interface ReactiveSetCommands {
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/spop">Redis Documentation: SPOP</a>
|
||||
*/
|
||||
default Mono<ByteBuffer> sPop(ByteBuffer key) {
|
||||
|
||||
@@ -261,6 +270,7 @@ public interface ReactiveSetCommands {
|
||||
*
|
||||
* @param commands
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/spop">Redis Documentation: SPOP</a>
|
||||
*/
|
||||
Flux<ByteBufferResponse<KeyCommand>> sPop(Publisher<KeyCommand> commands);
|
||||
|
||||
@@ -268,6 +278,7 @@ public interface ReactiveSetCommands {
|
||||
* {@code SMOVE} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/smove">Redis Documentation: SMOVE</a>
|
||||
*/
|
||||
class SMoveCommand extends KeyCommand {
|
||||
|
||||
@@ -343,6 +354,7 @@ public interface ReactiveSetCommands {
|
||||
* @param destinationKey must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/smove">Redis Documentation: SMOVE</a>
|
||||
*/
|
||||
default Mono<Boolean> sMove(ByteBuffer sourceKey, ByteBuffer destinationKey, ByteBuffer value) {
|
||||
|
||||
@@ -359,6 +371,7 @@ public interface ReactiveSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/smove">Redis Documentation: SMOVE</a>
|
||||
*/
|
||||
Flux<BooleanResponse<SMoveCommand>> sMove(Publisher<SMoveCommand> commands);
|
||||
|
||||
@@ -367,6 +380,7 @@ public interface ReactiveSetCommands {
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/scard">Redis Documentation: SCARD</a>
|
||||
*/
|
||||
default Mono<Long> sCard(ByteBuffer key) {
|
||||
|
||||
@@ -380,6 +394,7 @@ public interface ReactiveSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/scard">Redis Documentation: SCARD</a>
|
||||
*/
|
||||
Flux<NumericResponse<KeyCommand, Long>> sCard(Publisher<KeyCommand> commands);
|
||||
|
||||
@@ -387,6 +402,7 @@ public interface ReactiveSetCommands {
|
||||
* {@code SISMEMBER} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/sismember">Redis Documentation: SISMEMBER</a>
|
||||
*/
|
||||
class SIsMemberCommand extends KeyCommand {
|
||||
|
||||
@@ -439,6 +455,7 @@ public interface ReactiveSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sismember">Redis Documentation: SISMEMBER</a>
|
||||
*/
|
||||
default Mono<Boolean> sIsMember(ByteBuffer key, ByteBuffer value) {
|
||||
|
||||
@@ -453,6 +470,7 @@ public interface ReactiveSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sismember">Redis Documentation: SISMEMBER</a>
|
||||
*/
|
||||
Flux<BooleanResponse<SIsMemberCommand>> sIsMember(Publisher<SIsMemberCommand> commands);
|
||||
|
||||
@@ -460,6 +478,7 @@ public interface ReactiveSetCommands {
|
||||
* {@code SINTER} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/sinter">Redis Documentation: SINTER</a>
|
||||
*/
|
||||
class SInterCommand implements Command {
|
||||
|
||||
@@ -503,6 +522,7 @@ public interface ReactiveSetCommands {
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sinter">Redis Documentation: SINTER</a>
|
||||
*/
|
||||
default Mono<List<ByteBuffer>> sInter(Collection<ByteBuffer> keys) {
|
||||
|
||||
@@ -516,6 +536,7 @@ public interface ReactiveSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sinter">Redis Documentation: SINTER</a>
|
||||
*/
|
||||
Flux<MultiValueResponse<SInterCommand, ByteBuffer>> sInter(Publisher<SInterCommand> commands);
|
||||
|
||||
@@ -523,6 +544,7 @@ public interface ReactiveSetCommands {
|
||||
* {@code SINTERSTORE} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/sinterstore">Redis Documentation: SINTERSTORE</a>
|
||||
*/
|
||||
class SInterStoreCommand extends KeyCommand {
|
||||
|
||||
@@ -576,6 +598,7 @@ public interface ReactiveSetCommands {
|
||||
* @param destinationKey must not be {@literal null}.
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return size of set stored a {@literal destinationKey}.
|
||||
* @see <a href="http://redis.io/commands/sinterstore">Redis Documentation: SINTERSTORE</a>
|
||||
*/
|
||||
default Mono<Long> sInterStore(ByteBuffer destinationKey, Collection<ByteBuffer> keys) {
|
||||
|
||||
@@ -591,6 +614,7 @@ public interface ReactiveSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sinterstore">Redis Documentation: SINTERSTORE</a>
|
||||
*/
|
||||
Flux<NumericResponse<SInterStoreCommand, Long>> sInterStore(Publisher<SInterStoreCommand> commands);
|
||||
|
||||
@@ -598,6 +622,7 @@ public interface ReactiveSetCommands {
|
||||
* {@code SUNION} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/sunion">Redis Documentation: SUNION</a>
|
||||
*/
|
||||
class SUnionCommand implements Command {
|
||||
|
||||
@@ -641,6 +666,7 @@ public interface ReactiveSetCommands {
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sunion">Redis Documentation: SUNION</a>
|
||||
*/
|
||||
default Mono<List<ByteBuffer>> sUnion(Collection<ByteBuffer> keys) {
|
||||
|
||||
@@ -654,11 +680,15 @@ public interface ReactiveSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sunion">Redis Documentation: SUNION</a>
|
||||
*/
|
||||
Flux<MultiValueResponse<SUnionCommand, ByteBuffer>> sUnion(Publisher<SUnionCommand> commands);
|
||||
|
||||
/**
|
||||
* {@code SUNIONSTORE} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/sunionstore">Redis Documentation: SUNIONSTORE</a>
|
||||
*/
|
||||
class SUnionStoreCommand extends KeyCommand {
|
||||
|
||||
@@ -712,6 +742,7 @@ public interface ReactiveSetCommands {
|
||||
* @param destinationKey must not be {@literal null}.
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return size of set stored a {@literal destinationKey}.
|
||||
* @see <a href="http://redis.io/commands/sunionstore">Redis Documentation: SUNIONSTORE</a>
|
||||
*/
|
||||
default Mono<Long> sUnionStore(ByteBuffer destinationKey, Collection<ByteBuffer> keys) {
|
||||
|
||||
@@ -727,6 +758,7 @@ public interface ReactiveSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sunionstore">Redis Documentation: SUNIONSTORE</a>
|
||||
*/
|
||||
Flux<NumericResponse<SUnionStoreCommand, Long>> sUnionStore(Publisher<SUnionStoreCommand> commands);
|
||||
|
||||
@@ -734,6 +766,7 @@ public interface ReactiveSetCommands {
|
||||
* {@code SDIFF} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/sdiff">Redis Documentation: SDIFF</a>
|
||||
*/
|
||||
class SDiffCommand implements Command {
|
||||
|
||||
@@ -777,6 +810,7 @@ public interface ReactiveSetCommands {
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sdiff">Redis Documentation: SDIFF</a>
|
||||
*/
|
||||
default Mono<List<ByteBuffer>> sDiff(Collection<ByteBuffer> keys) {
|
||||
|
||||
@@ -790,6 +824,7 @@ public interface ReactiveSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sdiff">Redis Documentation: SDIFF</a>
|
||||
*/
|
||||
Flux<MultiValueResponse<SDiffCommand, ByteBuffer>> sDiff(Publisher<SDiffCommand> commands);
|
||||
|
||||
@@ -797,6 +832,7 @@ public interface ReactiveSetCommands {
|
||||
* {@code SDIFFSTORE} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/sdiffstore">Redis Documentation: SDIFFSTORE</a>
|
||||
*/
|
||||
class SDiffStoreCommand extends KeyCommand {
|
||||
|
||||
@@ -850,6 +886,7 @@ public interface ReactiveSetCommands {
|
||||
* @param destinationKey must not be {@literal null}.
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return size of set stored a {@literal destinationKey}.
|
||||
* @see <a href="http://redis.io/commands/sdiffstore">Redis Documentation: SDIFFSTORE</a>
|
||||
*/
|
||||
default Mono<Long> sDiffStore(ByteBuffer destinationKey, Collection<ByteBuffer> keys) {
|
||||
|
||||
@@ -865,6 +902,7 @@ public interface ReactiveSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sdiffstore">Redis Documentation: SDIFFSTORE</a>
|
||||
*/
|
||||
Flux<NumericResponse<SDiffStoreCommand, Long>> sDiffStore(Publisher<SDiffStoreCommand> commands);
|
||||
|
||||
@@ -873,6 +911,7 @@ public interface ReactiveSetCommands {
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/smembers">Redis Documentation: SMEMBERS</a>
|
||||
*/
|
||||
default Mono<List<ByteBuffer>> sMembers(ByteBuffer key) {
|
||||
|
||||
@@ -886,6 +925,7 @@ public interface ReactiveSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/smembers">Redis Documentation: SMEMBERS</a>
|
||||
*/
|
||||
Flux<MultiValueResponse<KeyCommand, ByteBuffer>> sMembers(Publisher<KeyCommand> commands);
|
||||
|
||||
@@ -893,6 +933,7 @@ public interface ReactiveSetCommands {
|
||||
* {@code SRANDMEMBER} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/srandmember">Redis Documentation: SRANDMEMBER</a>
|
||||
*/
|
||||
class SRandMembersCommand extends KeyCommand {
|
||||
|
||||
@@ -949,6 +990,7 @@ public interface ReactiveSetCommands {
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/srandmember">Redis Documentation: SRANDMEMBER</a>
|
||||
*/
|
||||
default Mono<ByteBuffer> sRandMember(ByteBuffer key) {
|
||||
return sRandMember(key, 1L).map(vals -> vals.isEmpty() ? null : vals.iterator().next());
|
||||
@@ -960,6 +1002,7 @@ public interface ReactiveSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param count must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/srandmember">Redis Documentation: SRANDMEMBER</a>
|
||||
*/
|
||||
default Mono<List<ByteBuffer>> sRandMember(ByteBuffer key, Long count) {
|
||||
|
||||
@@ -975,6 +1018,7 @@ public interface ReactiveSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/srandmember">Redis Documentation: SRANDMEMBER</a>
|
||||
*/
|
||||
Flux<MultiValueResponse<SRandMembersCommand, ByteBuffer>> sRandMember(Publisher<SRandMembersCommand> commands);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,9 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -37,9 +40,6 @@ import org.springframework.data.redis.connection.RedisStringCommands.SetOption;
|
||||
import org.springframework.data.redis.core.types.Expiration;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* Redis String commands executed using reactive infrastructure.
|
||||
*
|
||||
@@ -53,6 +53,7 @@ public interface ReactiveStringCommands {
|
||||
* {@code SET} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/set">Redis Documentation: SET</a>
|
||||
*/
|
||||
class SetCommand extends KeyCommand {
|
||||
|
||||
@@ -149,6 +150,7 @@ public interface ReactiveStringCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/set">Redis Documentation: SET</a>
|
||||
*/
|
||||
default Mono<Boolean> set(ByteBuffer key, ByteBuffer value) {
|
||||
|
||||
@@ -166,6 +168,7 @@ public interface ReactiveStringCommands {
|
||||
* @param expiration must not be {@literal null}.
|
||||
* @param option must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/set">Redis Documentation: SET</a>
|
||||
*/
|
||||
default Mono<Boolean> set(ByteBuffer key, ByteBuffer value, Expiration expiration, SetOption option) {
|
||||
|
||||
@@ -181,6 +184,7 @@ public interface ReactiveStringCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return {@link Flux} of {@link BooleanResponse} holding the {@link SetCommand} along with the command result.
|
||||
* @see <a href="http://redis.io/commands/set">Redis Documentation: SET</a>
|
||||
*/
|
||||
Flux<BooleanResponse<SetCommand>> set(Publisher<SetCommand> commands);
|
||||
|
||||
@@ -189,6 +193,7 @@ public interface ReactiveStringCommands {
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return empty {@link ByteBuffer} in case {@literal key} does not exist.
|
||||
* @see <a href="http://redis.io/commands/get">Redis Documentation: GET</a>
|
||||
*/
|
||||
default Mono<ByteBuffer> get(ByteBuffer key) {
|
||||
|
||||
@@ -203,6 +208,7 @@ public interface ReactiveStringCommands {
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return {@link Flux} of {@link ByteBufferResponse} holding the {@literal key} to get along with the value
|
||||
* retrieved.
|
||||
* @see <a href="http://redis.io/commands/get">Redis Documentation: GET</a>
|
||||
*/
|
||||
Flux<ByteBufferResponse<KeyCommand>> get(Publisher<KeyCommand> keys);
|
||||
|
||||
@@ -212,6 +218,7 @@ public interface ReactiveStringCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/getset">Redis Documentation: GETSET</a>
|
||||
*/
|
||||
default Mono<ByteBuffer> getSet(ByteBuffer key, ByteBuffer value) {
|
||||
|
||||
@@ -227,6 +234,7 @@ public interface ReactiveStringCommands {
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return {@link Flux} of {@link ByteBufferResponse} holding the {@link SetCommand} along with the previously
|
||||
* existing value.
|
||||
* @see <a href="http://redis.io/commands/getset">Redis Documentation: GETSET</a>
|
||||
*/
|
||||
Flux<ByteBufferResponse<SetCommand>> getSet(Publisher<SetCommand> commands);
|
||||
|
||||
@@ -235,6 +243,7 @@ public interface ReactiveStringCommands {
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/mget">Redis Documentation: MGET</a>
|
||||
*/
|
||||
default Mono<List<ByteBuffer>> mGet(List<ByteBuffer> keys) {
|
||||
|
||||
@@ -248,6 +257,7 @@ public interface ReactiveStringCommands {
|
||||
*
|
||||
* @param keysets must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/mget">Redis Documentation: MGET</a>
|
||||
*/
|
||||
Flux<MultiValueResponse<List<ByteBuffer>, ByteBuffer>> mGet(Publisher<List<ByteBuffer>> keysets);
|
||||
|
||||
@@ -257,6 +267,7 @@ public interface ReactiveStringCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/setnx">Redis Documentation: SETNX</a>
|
||||
*/
|
||||
default Mono<Boolean> setNX(ByteBuffer key, ByteBuffer value) {
|
||||
|
||||
@@ -271,6 +282,7 @@ public interface ReactiveStringCommands {
|
||||
*
|
||||
* @param values must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/setnx">Redis Documentation: SETNX</a>
|
||||
*/
|
||||
Flux<BooleanResponse<SetCommand>> setNX(Publisher<SetCommand> values);
|
||||
|
||||
@@ -281,6 +293,7 @@ public interface ReactiveStringCommands {
|
||||
* @param value must not be {@literal null}.
|
||||
* @param expireTimeout must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/setex">Redis Documentation: SETEX</a>
|
||||
*/
|
||||
default Mono<Boolean> setEX(ByteBuffer key, ByteBuffer value, Expiration expireTimeout) {
|
||||
|
||||
@@ -297,6 +310,7 @@ public interface ReactiveStringCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/setex">Redis Documentation: SETEX</a>
|
||||
*/
|
||||
Flux<BooleanResponse<SetCommand>> setEX(Publisher<SetCommand> commands);
|
||||
|
||||
@@ -307,6 +321,7 @@ public interface ReactiveStringCommands {
|
||||
* @param value must not be {@literal null}.
|
||||
* @param expireTimeout must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/psetex">Redis Documentation: PSETEX</a>
|
||||
*/
|
||||
default Mono<Boolean> pSetEX(ByteBuffer key, ByteBuffer value, Expiration expireTimeout) {
|
||||
|
||||
@@ -323,6 +338,7 @@ public interface ReactiveStringCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/psetex">Redis Documentation: PSETEX</a>
|
||||
*/
|
||||
Flux<BooleanResponse<SetCommand>> pSetEX(Publisher<SetCommand> commands);
|
||||
|
||||
@@ -330,6 +346,7 @@ public interface ReactiveStringCommands {
|
||||
* {@code MSET} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/mset">Redis Documentation: MSET</a>
|
||||
*/
|
||||
class MSetCommand implements Command {
|
||||
|
||||
@@ -373,6 +390,7 @@ public interface ReactiveStringCommands {
|
||||
*
|
||||
* @param keyValuePairs must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/mset">Redis Documentation: MSET</a>
|
||||
*/
|
||||
default Mono<Boolean> mSet(Map<ByteBuffer, ByteBuffer> keyValuePairs) {
|
||||
|
||||
@@ -386,6 +404,7 @@ public interface ReactiveStringCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/mset">Redis Documentation: MSET</a>
|
||||
*/
|
||||
Flux<BooleanResponse<MSetCommand>> mSet(Publisher<MSetCommand> commands);
|
||||
|
||||
@@ -395,6 +414,7 @@ public interface ReactiveStringCommands {
|
||||
*
|
||||
* @param keyValuePairs must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/msetnx">Redis Documentation: MSETNX</a>
|
||||
*/
|
||||
default Mono<Boolean> mSetNX(Map<ByteBuffer, ByteBuffer> keyValuePairs) {
|
||||
|
||||
@@ -409,6 +429,7 @@ public interface ReactiveStringCommands {
|
||||
*
|
||||
* @param source must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/msetnx">Redis Documentation: MSETNX</a>
|
||||
*/
|
||||
Flux<BooleanResponse<MSetCommand>> mSetNX(Publisher<MSetCommand> source);
|
||||
|
||||
@@ -416,6 +437,7 @@ public interface ReactiveStringCommands {
|
||||
* {@code APPEND} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/append">Redis Documentation: APPEND</a>
|
||||
*/
|
||||
class AppendCommand extends KeyCommand {
|
||||
|
||||
@@ -468,6 +490,7 @@ public interface ReactiveStringCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/append">Redis Documentation: APPEND</a>
|
||||
*/
|
||||
default Mono<Long> append(ByteBuffer key, ByteBuffer value) {
|
||||
|
||||
@@ -482,6 +505,7 @@ public interface ReactiveStringCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/append">Redis Documentation: APPEND</a>
|
||||
*/
|
||||
Flux<NumericResponse<AppendCommand, Long>> append(Publisher<AppendCommand> commands);
|
||||
|
||||
@@ -492,6 +516,7 @@ public interface ReactiveStringCommands {
|
||||
* @param begin
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/getrange">Redis Documentation: GETRANGE</a>
|
||||
*/
|
||||
default Mono<ByteBuffer> getRange(ByteBuffer key, long begin, long end) {
|
||||
|
||||
@@ -507,6 +532,7 @@ public interface ReactiveStringCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/getrange">Redis Documentation: GETRANGE</a>
|
||||
*/
|
||||
Flux<ByteBufferResponse<RangeCommand>> getRange(Publisher<RangeCommand> commands);
|
||||
|
||||
@@ -514,6 +540,7 @@ public interface ReactiveStringCommands {
|
||||
* {@code SETRANGE} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/setrange">Redis Documentation: SETRANGE</a>
|
||||
*/
|
||||
class SetRangeCommand extends KeyCommand {
|
||||
|
||||
@@ -585,6 +612,7 @@ public interface ReactiveStringCommands {
|
||||
* @param value must not be {@literal null}.
|
||||
* @param offset
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/setrange">Redis Documentation: SETRANGE</a>
|
||||
*/
|
||||
default Mono<Long> setRange(ByteBuffer key, ByteBuffer value, long offset) {
|
||||
|
||||
@@ -601,6 +629,7 @@ public interface ReactiveStringCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/setrange">Redis Documentation: SETRANGE</a>
|
||||
*/
|
||||
Flux<NumericResponse<SetRangeCommand, Long>> setRange(Publisher<SetRangeCommand> commands);
|
||||
|
||||
@@ -608,6 +637,7 @@ public interface ReactiveStringCommands {
|
||||
* {@code GETBIT} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/getbit">Redis Documentation: GETBIT</a>
|
||||
*/
|
||||
class GetBitCommand extends KeyCommand {
|
||||
|
||||
@@ -657,6 +687,7 @@ public interface ReactiveStringCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param offset
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/getbit">Redis Documentation: GETBIT</a>
|
||||
*/
|
||||
default Mono<Boolean> getBit(ByteBuffer key, long offset) {
|
||||
|
||||
@@ -670,6 +701,7 @@ public interface ReactiveStringCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/getbit">Redis Documentation: GETBIT</a>
|
||||
*/
|
||||
Flux<BooleanResponse<GetBitCommand>> getBit(Publisher<GetBitCommand> commands);
|
||||
|
||||
@@ -677,6 +709,7 @@ public interface ReactiveStringCommands {
|
||||
* {@code SETBIT} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/setbit">Redis Documentation: SETBIT</a>
|
||||
*/
|
||||
class SetBitCommand extends KeyCommand {
|
||||
|
||||
@@ -759,6 +792,7 @@ public interface ReactiveStringCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/setbit">Redis Documentation: SETBIT</a>
|
||||
*/
|
||||
Flux<BooleanResponse<SetBitCommand>> setBit(Publisher<SetBitCommand> commands);
|
||||
|
||||
@@ -766,6 +800,7 @@ public interface ReactiveStringCommands {
|
||||
* {@code BITCOUNT} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/bitcount">Redis Documentation: BITCOUNT</a>
|
||||
*/
|
||||
class BitCountCommand extends KeyCommand {
|
||||
|
||||
@@ -817,6 +852,7 @@ public interface ReactiveStringCommands {
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/bitcount">Redis Documentation: BITCOUNT</a>
|
||||
*/
|
||||
default Mono<Long> bitCount(ByteBuffer key) {
|
||||
|
||||
@@ -833,6 +869,7 @@ public interface ReactiveStringCommands {
|
||||
* @param begin
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/bitcount">Redis Documentation: BITCOUNT</a>
|
||||
*/
|
||||
default Mono<Long> bitCount(ByteBuffer key, long begin, long end) {
|
||||
|
||||
@@ -848,6 +885,7 @@ public interface ReactiveStringCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/bitcount">Redis Documentation: BITCOUNT</a>
|
||||
*/
|
||||
Flux<NumericResponse<BitCountCommand, Long>> bitCount(Publisher<BitCountCommand> commands);
|
||||
|
||||
@@ -855,6 +893,7 @@ public interface ReactiveStringCommands {
|
||||
* {@code BITOP} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/bitop">Redis Documentation: BITOP</a>
|
||||
*/
|
||||
class BitOpCommand {
|
||||
|
||||
@@ -939,6 +978,7 @@ public interface ReactiveStringCommands {
|
||||
* @param bitOp must not be {@literal null}.
|
||||
* @param destination must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/bitop">Redis Documentation: BITOP</a>
|
||||
*/
|
||||
default Mono<Long> bitOp(Collection<ByteBuffer> keys, BitOperation bitOp, ByteBuffer destination) {
|
||||
|
||||
@@ -956,6 +996,7 @@ public interface ReactiveStringCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/bitop">Redis Documentation: BITOP</a>
|
||||
*/
|
||||
Flux<NumericResponse<BitOpCommand, Long>> bitOp(Publisher<BitOpCommand> commands);
|
||||
|
||||
@@ -964,6 +1005,7 @@ public interface ReactiveStringCommands {
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/strlen">Redis Documentation: STRLEN</a>
|
||||
*/
|
||||
default Mono<Long> strLen(ByteBuffer key) {
|
||||
|
||||
@@ -977,6 +1019,7 @@ public interface ReactiveStringCommands {
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/strlen">Redis Documentation: STRLEN</a>
|
||||
*/
|
||||
Flux<NumericResponse<KeyCommand, Long>> strLen(Publisher<KeyCommand> keys);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,9 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -23,7 +26,6 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.lambdaworks.redis.Range.Boundary;
|
||||
import org.reactivestreams.Publisher;
|
||||
import org.springframework.data.domain.Range;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
@@ -36,9 +38,6 @@ import org.springframework.data.redis.connection.RedisZSetCommands.Tuple;
|
||||
import org.springframework.data.redis.util.ByteUtils;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* Redis Sorted Set commands executed using reactive infrastructure.
|
||||
*
|
||||
@@ -52,6 +51,7 @@ public interface ReactiveZSetCommands {
|
||||
* {@code ZADD} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/zadd">Redis Documentation: ZADD</a>
|
||||
*/
|
||||
class ZAddCommand extends KeyCommand {
|
||||
|
||||
@@ -185,6 +185,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param score must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zadd">Redis Documentation: ZADD</a>
|
||||
*/
|
||||
default Mono<Long> zAdd(ByteBuffer key, Double score, ByteBuffer value) {
|
||||
|
||||
@@ -202,6 +203,7 @@ public interface ReactiveZSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zadd">Redis Documentation: ZADD</a>
|
||||
*/
|
||||
Flux<NumericResponse<ZAddCommand, Number>> zAdd(Publisher<ZAddCommand> commands);
|
||||
|
||||
@@ -209,6 +211,7 @@ public interface ReactiveZSetCommands {
|
||||
* {@code ZREM} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/zrem">Redis Documentation: ZREM</a>
|
||||
*/
|
||||
class ZRemCommand extends KeyCommand {
|
||||
|
||||
@@ -274,6 +277,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrem">Redis Documentation: ZREM</a>
|
||||
*/
|
||||
default Mono<Long> zRem(ByteBuffer key, ByteBuffer value) {
|
||||
|
||||
@@ -288,6 +292,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param values must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrem">Redis Documentation: ZREM</a>
|
||||
*/
|
||||
default Mono<Long> zRem(ByteBuffer key, Collection<ByteBuffer> values) {
|
||||
|
||||
@@ -302,6 +307,7 @@ public interface ReactiveZSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrem">Redis Documentation: ZREM</a>
|
||||
*/
|
||||
Flux<NumericResponse<ZRemCommand, Long>> zRem(Publisher<ZRemCommand> commands);
|
||||
|
||||
@@ -309,6 +315,7 @@ public interface ReactiveZSetCommands {
|
||||
* {@code ZINCRBY} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/zincrby">Redis Documentation: ZINCRBY</a>
|
||||
*/
|
||||
class ZIncrByCommand extends KeyCommand {
|
||||
|
||||
@@ -385,6 +392,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param increment must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zincrby">Redis Documentation: ZINCRBY</a>
|
||||
*/
|
||||
default Mono<Double> zIncrBy(ByteBuffer key, Number increment, ByteBuffer value) {
|
||||
|
||||
@@ -402,6 +410,7 @@ public interface ReactiveZSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zincrby">Redis Documentation: ZINCRBY</a>
|
||||
*/
|
||||
Flux<NumericResponse<ZIncrByCommand, Double>> zIncrBy(Publisher<ZIncrByCommand> commands);
|
||||
|
||||
@@ -409,6 +418,8 @@ public interface ReactiveZSetCommands {
|
||||
* {@code ZRANK}/{@literal ZREVRANK} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/zrank">Redis Documentation: ZRANK</a>
|
||||
* @see <a href="http://redis.io/commands/zrevrank">Redis Documentation: ZREVRANK</a>
|
||||
*/
|
||||
class ZRankCommand extends KeyCommand {
|
||||
|
||||
@@ -484,6 +495,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrank">Redis Documentation: ZRANK</a>
|
||||
*/
|
||||
default Mono<Long> zRank(ByteBuffer key, ByteBuffer value) {
|
||||
|
||||
@@ -499,6 +511,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrank">Redis Documentation: ZREVRANK</a>
|
||||
*/
|
||||
default Mono<Long> zRevRank(ByteBuffer key, ByteBuffer value) {
|
||||
|
||||
@@ -515,6 +528,8 @@ public interface ReactiveZSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrank">Redis Documentation: ZRANK</a>
|
||||
* @see <a href="http://redis.io/commands/zrevrank">Redis Documentation: ZREVRANK</a>
|
||||
*/
|
||||
Flux<NumericResponse<ZRankCommand, Long>> zRank(Publisher<ZRankCommand> commands);
|
||||
|
||||
@@ -522,6 +537,8 @@ public interface ReactiveZSetCommands {
|
||||
* {@code ZRANGE}/{@literal ZREVRANGE} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/zrange">Redis Documentation: ZRANGE</a>
|
||||
* @see <a href="http://redis.io/commands/zrevrange">Redis Documentation: ZREVRANGE</a>
|
||||
*/
|
||||
class ZRangeCommand extends KeyCommand {
|
||||
|
||||
@@ -617,6 +634,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrange">Redis Documentation: ZRANGE</a>
|
||||
*/
|
||||
default Mono<List<ByteBuffer>> zRange(ByteBuffer key, Range<Long> range) {
|
||||
|
||||
@@ -637,6 +655,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrange">Redis Documentation: ZRANGE</a>
|
||||
*/
|
||||
default Mono<List<Tuple>> zRangeWithScores(ByteBuffer key, Range<Long> range) {
|
||||
|
||||
@@ -652,6 +671,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrange">Redis Documentation: ZREVRANGE</a>
|
||||
*/
|
||||
default Mono<List<ByteBuffer>> zRevRange(ByteBuffer key, Range<Long> range) {
|
||||
|
||||
@@ -667,6 +687,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrange">Redis Documentation: ZREVRANGE</a>
|
||||
*/
|
||||
default Mono<List<Tuple>> zRevRangeWithScores(ByteBuffer key, Range<Long> range) {
|
||||
|
||||
@@ -681,6 +702,8 @@ public interface ReactiveZSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrange">Redis Documentation: ZRANGE</a>
|
||||
* @see <a href="http://redis.io/commands/zrevrange">Redis Documentation: ZREVRANGE</a>
|
||||
*/
|
||||
Flux<MultiValueResponse<ZRangeCommand, Tuple>> zRange(Publisher<ZRangeCommand> commands);
|
||||
|
||||
@@ -688,6 +711,8 @@ public interface ReactiveZSetCommands {
|
||||
* {@literal ZRANGEBYSCORE}/{@literal ZREVRANGEBYSCORE}.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
|
||||
* @see <a href="http://redis.io/commands/zrevrangebyscore">Redis Documentation: ZREVRANGEBYSCORE</a>
|
||||
*/
|
||||
class ZRangeByScoreCommand extends KeyCommand {
|
||||
|
||||
@@ -803,6 +828,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
|
||||
*/
|
||||
default Mono<List<ByteBuffer>> zRangeByScore(ByteBuffer key, Range<Double> range) {
|
||||
|
||||
@@ -824,6 +850,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param range must not be {@literal null}.
|
||||
* @param limit can be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
|
||||
*/
|
||||
default Mono<List<ByteBuffer>> zRangeByScore(ByteBuffer key, Range<Double> range, Limit limit) {
|
||||
|
||||
@@ -844,6 +871,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
|
||||
*/
|
||||
default Mono<List<Tuple>> zRangeByScoreWithScores(ByteBuffer key, Range<Double> range) {
|
||||
|
||||
@@ -861,6 +889,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param range must not be {@literal null}.
|
||||
* @param limit can be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
|
||||
*/
|
||||
default Mono<List<Tuple>> zRangeByScoreWithScores(ByteBuffer key, Range<Double> range, Limit limit) {
|
||||
|
||||
@@ -877,6 +906,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrangebyscore">Redis Documentation: ZREVRANGEBYSCORE</a>
|
||||
*/
|
||||
default Mono<List<ByteBuffer>> zRevRangeByScore(ByteBuffer key, Range<Double> range) {
|
||||
|
||||
@@ -897,6 +927,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param range must not be {@literal null}.
|
||||
* @param limit can be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrangebyscore">Redis Documentation: ZREVRANGEBYSCORE</a>
|
||||
*/
|
||||
default Mono<List<ByteBuffer>> zRevRangeByScore(ByteBuffer key, Range<Double> range, Limit limit) {
|
||||
|
||||
@@ -915,6 +946,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrangebyscore">Redis Documentation: ZREVRANGEBYSCORE</a>
|
||||
*/
|
||||
default Mono<List<Tuple>> zRevRangeByScoreWithScores(ByteBuffer key, Range<Double> range) {
|
||||
|
||||
@@ -932,6 +964,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param range must not be {@literal null}.
|
||||
* @param limit can be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrangebyscore">Redis Documentation: ZREVRANGEBYSCORE</a>
|
||||
*/
|
||||
default Mono<List<Tuple>> zRevRangeByScoreWithScores(ByteBuffer key, Range<Double> range, Limit limit) {
|
||||
|
||||
@@ -948,6 +981,8 @@ public interface ReactiveZSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
|
||||
* @see <a href="http://redis.io/commands/zrevrangebyscore">Redis Documentation: ZREVRANGEBYSCORE</a>
|
||||
*/
|
||||
Flux<MultiValueResponse<ZRangeByScoreCommand, Tuple>> zRangeByScore(Publisher<ZRangeByScoreCommand> commands);
|
||||
|
||||
@@ -955,6 +990,7 @@ public interface ReactiveZSetCommands {
|
||||
* {@code ZCOUNT} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/zcount">Redis Documentation: ZCOUNT</a>
|
||||
*/
|
||||
class ZCountCommand extends KeyCommand {
|
||||
|
||||
@@ -1008,6 +1044,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zcount">Redis Documentation: ZCOUNT</a>
|
||||
*/
|
||||
default Mono<Long> zCount(ByteBuffer key, Range<Double> range) {
|
||||
|
||||
@@ -1024,6 +1061,7 @@ public interface ReactiveZSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zcount">Redis Documentation: ZCOUNT</a>
|
||||
*/
|
||||
Flux<NumericResponse<ZCountCommand, Long>> zCount(Publisher<ZCountCommand> commands);
|
||||
|
||||
@@ -1032,6 +1070,7 @@ public interface ReactiveZSetCommands {
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zcard">Redis Documentation: ZCARD</a>
|
||||
*/
|
||||
default Mono<Long> zCard(ByteBuffer key) {
|
||||
|
||||
@@ -1045,6 +1084,7 @@ public interface ReactiveZSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zcard">Redis Documentation: ZCARD</a>
|
||||
*/
|
||||
Flux<NumericResponse<KeyCommand, Long>> zCard(Publisher<KeyCommand> commands);
|
||||
|
||||
@@ -1052,6 +1092,7 @@ public interface ReactiveZSetCommands {
|
||||
* {@code ZSCORE} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/zscore">Redis Documentation: ZSCORE</a>
|
||||
*/
|
||||
class ZScoreCommand extends KeyCommand {
|
||||
|
||||
@@ -1103,6 +1144,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zscore">Redis Documentation: ZSCORE</a>
|
||||
*/
|
||||
default Mono<Double> zScore(ByteBuffer key, ByteBuffer value) {
|
||||
|
||||
@@ -1118,6 +1160,7 @@ public interface ReactiveZSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zscore">Redis Documentation: ZSCORE</a>
|
||||
*/
|
||||
Flux<NumericResponse<ZScoreCommand, Double>> zScore(Publisher<ZScoreCommand> commands);
|
||||
|
||||
@@ -1125,6 +1168,7 @@ public interface ReactiveZSetCommands {
|
||||
* {@code ZREMRANGEBYRANK} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/zremrangebyrank">Redis Documentation: ZREMRANGEBYRANK</a>
|
||||
*/
|
||||
class ZRemRangeByRankCommand extends KeyCommand {
|
||||
|
||||
@@ -1175,6 +1219,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zremrangebyrank">Redis Documentation: ZREMRANGEBYRANK</a>
|
||||
*/
|
||||
default Mono<Long> zRemRangeByRank(ByteBuffer key, Range<Long> range) {
|
||||
|
||||
@@ -1190,6 +1235,7 @@ public interface ReactiveZSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zremrangebyrank">Redis Documentation: ZREMRANGEBYRANK</a>
|
||||
*/
|
||||
Flux<NumericResponse<ZRemRangeByRankCommand, Long>> zRemRangeByRank(Publisher<ZRemRangeByRankCommand> commands);
|
||||
|
||||
@@ -1197,6 +1243,7 @@ public interface ReactiveZSetCommands {
|
||||
* {@code ZREMRANGEBYSCORE} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/zremrangebyscore">Redis Documentation: ZREMRANGEBYSCORE</a>
|
||||
*/
|
||||
class ZRemRangeByScoreCommand extends KeyCommand {
|
||||
|
||||
@@ -1245,6 +1292,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zremrangebyscore">Redis Documentation: ZREMRANGEBYSCORE</a>
|
||||
*/
|
||||
default Mono<Long> zRemRangeByScore(ByteBuffer key, Range<Double> range) {
|
||||
|
||||
@@ -1260,6 +1308,7 @@ public interface ReactiveZSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zremrangebyscore">Redis Documentation: ZREMRANGEBYSCORE</a>
|
||||
*/
|
||||
Flux<NumericResponse<ZRemRangeByScoreCommand, Long>> zRemRangeByScore(Publisher<ZRemRangeByScoreCommand> commands);
|
||||
|
||||
@@ -1267,6 +1316,7 @@ public interface ReactiveZSetCommands {
|
||||
* {@code ZUNIONSTORE} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/zunionstore">Redis Documentation: ZUNIONSTORE</a>
|
||||
*/
|
||||
class ZUnionStoreCommand extends KeyCommand {
|
||||
|
||||
@@ -1358,6 +1408,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param destinationKey must not be {@literal null}.
|
||||
* @param sets must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zunionstore">Redis Documentation: ZUNIONSTORE</a>
|
||||
*/
|
||||
default Mono<Long> zUnionStore(ByteBuffer destinationKey, List<ByteBuffer> sets) {
|
||||
return zUnionStore(destinationKey, sets, null);
|
||||
@@ -1371,6 +1422,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param sets must not be {@literal null}.
|
||||
* @param weights can be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zunionstore">Redis Documentation: ZUNIONSTORE</a>
|
||||
*/
|
||||
default Mono<Long> zUnionStore(ByteBuffer destinationKey, List<ByteBuffer> sets, List<Double> weights) {
|
||||
return zUnionStore(destinationKey, sets, weights, null);
|
||||
@@ -1385,6 +1437,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param weights can be {@literal null}.
|
||||
* @param aggregateFunction can be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zunionstore">Redis Documentation: ZUNIONSTORE</a>
|
||||
*/
|
||||
default Mono<Long> zUnionStore(ByteBuffer destinationKey, List<ByteBuffer> sets, List<Double> weights,
|
||||
Aggregate aggregateFunction) {
|
||||
@@ -1403,6 +1456,7 @@ public interface ReactiveZSetCommands {
|
||||
*
|
||||
* @param commands
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zunionstore">Redis Documentation: ZUNIONSTORE</a>
|
||||
*/
|
||||
Flux<NumericResponse<ZUnionStoreCommand, Long>> zUnionStore(Publisher<ZUnionStoreCommand> commands);
|
||||
|
||||
@@ -1410,6 +1464,7 @@ public interface ReactiveZSetCommands {
|
||||
* {@code ZINTERSTORE} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/zinterstore">Redis Documentation: ZINTERSTORE</a>
|
||||
*/
|
||||
class ZInterStoreCommand extends KeyCommand {
|
||||
|
||||
@@ -1502,6 +1557,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param destinationKey must not be {@literal null}.
|
||||
* @param sets must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zinterstore">Redis Documentation: ZINTERSTORE</a>
|
||||
*/
|
||||
default Mono<Long> zInterStore(ByteBuffer destinationKey, List<ByteBuffer> sets) {
|
||||
return zInterStore(destinationKey, sets, null);
|
||||
@@ -1515,6 +1571,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param sets must not be {@literal null}.
|
||||
* @param weights can be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zinterstore">Redis Documentation: ZINTERSTORE</a>
|
||||
*/
|
||||
default Mono<Long> zInterStore(ByteBuffer destinationKey, List<ByteBuffer> sets, List<Double> weights) {
|
||||
return zInterStore(destinationKey, sets, weights, null);
|
||||
@@ -1529,6 +1586,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param weights can be {@literal null}.
|
||||
* @param aggregateFunction can be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zinterstore">Redis Documentation: ZINTERSTORE</a>
|
||||
*/
|
||||
default Mono<Long> zInterStore(ByteBuffer destinationKey, List<ByteBuffer> sets, List<Double> weights,
|
||||
Aggregate aggregateFunction) {
|
||||
@@ -1547,6 +1605,7 @@ public interface ReactiveZSetCommands {
|
||||
*
|
||||
* @param commands
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zinterstore">Redis Documentation: ZINTERSTORE</a>
|
||||
*/
|
||||
Flux<NumericResponse<ZInterStoreCommand, Long>> zInterStore(Publisher<ZInterStoreCommand> commands);
|
||||
|
||||
@@ -1554,6 +1613,8 @@ public interface ReactiveZSetCommands {
|
||||
* {@code ZRANGEBYLEX}/{@literal ZREVRANGEBYLEX} command parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands/zrangebylex">Redis Documentation: ZRANGEBYLEX</a>
|
||||
* @see <a href="http://redis.io/commands/zrevrangebylex">Redis Documentation: ZREVRANGEBYLEX</a>
|
||||
*/
|
||||
class ZRangeByLexCommand extends KeyCommand {
|
||||
|
||||
@@ -1648,6 +1709,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrangebylex">Redis Documentation: ZRANGEBYLEX</a>
|
||||
*/
|
||||
default Mono<List<ByteBuffer>> zRangeByLex(ByteBuffer key, Range<String> range) {
|
||||
return zRangeByLex(key, range, null);
|
||||
@@ -1661,6 +1723,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param range must not be {@literal null}.
|
||||
* @param limit can be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrangebylex">Redis Documentation: ZRANGEBYLEX</a>
|
||||
*/
|
||||
default Mono<List<ByteBuffer>> zRangeByLex(ByteBuffer key, Range<String> range, Limit limit) {
|
||||
|
||||
@@ -1677,6 +1740,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrangebylex">Redis Documentation: ZREVRANGEBYLEX</a>
|
||||
*/
|
||||
default Mono<List<ByteBuffer>> zRevRangeByLex(ByteBuffer key, Range<String> range) {
|
||||
return zRevRangeByLex(key, range, null);
|
||||
@@ -1690,6 +1754,7 @@ public interface ReactiveZSetCommands {
|
||||
* @param range must not be {@literal null}.
|
||||
* @param limit can be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrangebylex">Redis Documentation: ZREVRANGEBYLEX</a>
|
||||
*/
|
||||
default Mono<List<ByteBuffer>> zRevRangeByLex(ByteBuffer key, Range<String> range, Limit limit) {
|
||||
|
||||
@@ -1706,6 +1771,8 @@ public interface ReactiveZSetCommands {
|
||||
*
|
||||
* @param commands must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrangebylex">Redis Documentation: ZRANGEBYLEX</a>
|
||||
* @see <a href="http://redis.io/commands/zrevrangebylex">Redis Documentation: ZREVRANGEBYLEX</a>
|
||||
*/
|
||||
Flux<MultiValueResponse<ZRangeByLexCommand, ByteBuffer>> zRangeByLex(Publisher<ZRangeByLexCommand> commands);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -36,6 +36,7 @@ public interface RedisClusterCommands {
|
||||
* Retrieve cluster node information such as {@literal id}, {@literal host}, {@literal port} and {@literal slots}.
|
||||
*
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="https://redis.io/commands/cluster-nodes">Redis Documentation: CLUSTER NODES</a>
|
||||
*/
|
||||
Iterable<RedisClusterNode> clusterGetNodes();
|
||||
|
||||
@@ -44,6 +45,7 @@ public interface RedisClusterCommands {
|
||||
*
|
||||
* @param master must not be {@literal null}.
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="https://redis.io/commands/cluster-slaves">Redis Documentation: CLUSTER SLAVES</a>
|
||||
*/
|
||||
Collection<RedisClusterNode> clusterGetSlaves(RedisClusterNode master);
|
||||
|
||||
@@ -51,6 +53,7 @@ public interface RedisClusterCommands {
|
||||
* Retrieve information about masters and their connected slaves.
|
||||
*
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="https://redis.io/commands/cluster-slaves">Redis Documentation: CLUSTER SLAVES</a>
|
||||
*/
|
||||
Map<RedisClusterNode, Collection<RedisClusterNode>> clusterGetMasterSlaveMap();
|
||||
|
||||
@@ -59,6 +62,7 @@ public interface RedisClusterCommands {
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="https://redis.io/commands/cluster-keyslot">Redis Documentation: CLUSTER KEYSLOT</a>
|
||||
*/
|
||||
Integer clusterGetSlotForKey(byte[] key);
|
||||
|
||||
@@ -82,6 +86,7 @@ public interface RedisClusterCommands {
|
||||
* Get cluster information.
|
||||
*
|
||||
* @return
|
||||
* @see <a href="https://redis.io/commands/cluster-info">Redis Documentation: CLUSTER INFO</a>
|
||||
*/
|
||||
ClusterInfo clusterGetClusterInfo();
|
||||
|
||||
@@ -90,6 +95,7 @@ public interface RedisClusterCommands {
|
||||
*
|
||||
* @param node must not be {@literal null}.
|
||||
* @param slots
|
||||
* @see <a href="https://redis.io/commands/cluster-addslots">Redis Documentation: CLUSTER ADDSLOTS</a>
|
||||
*/
|
||||
void clusterAddSlots(RedisClusterNode node, int... slots);
|
||||
|
||||
@@ -98,6 +104,7 @@ public interface RedisClusterCommands {
|
||||
*
|
||||
* @param node must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @see <a href="https://redis.io/commands/cluster-addslots">Redis Documentation: CLUSTER ADDSLOTS</a>
|
||||
*/
|
||||
void clusterAddSlots(RedisClusterNode node, SlotRange range);
|
||||
|
||||
@@ -106,6 +113,7 @@ public interface RedisClusterCommands {
|
||||
*
|
||||
* @param slot
|
||||
* @return
|
||||
* @see <a href="https://redis.io/commands/cluster-countkeysinslot">Redis Documentation: CLUSTER COUNTKEYSINSLOT</a>
|
||||
*/
|
||||
Long clusterCountKeysInSlot(int slot);
|
||||
|
||||
@@ -114,6 +122,7 @@ public interface RedisClusterCommands {
|
||||
*
|
||||
* @param node must not be {@literal null}.
|
||||
* @param slots
|
||||
* @see <a href="https://redis.io/commands/cluster-delslots">Redis Documentation: CLUSTER DELSLOTS</a>
|
||||
*/
|
||||
void clusterDeleteSlots(RedisClusterNode node, int... slots);
|
||||
|
||||
@@ -122,6 +131,7 @@ public interface RedisClusterCommands {
|
||||
*
|
||||
* @param node must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @see <a href="https://redis.io/commands/cluster-delslots">Redis Documentation: CLUSTER DELSLOTS</a>
|
||||
*/
|
||||
void clusterDeleteSlotsInRange(RedisClusterNode node, SlotRange range);
|
||||
|
||||
@@ -129,6 +139,7 @@ public interface RedisClusterCommands {
|
||||
* Remove given {@literal node} from cluster.
|
||||
*
|
||||
* @param node must not be {@literal null}.
|
||||
* @see <a href="https://redis.io/commands/cluster-forget">Redis Documentation: CLUSTER FORGET</a>
|
||||
*/
|
||||
void clusterForget(RedisClusterNode node);
|
||||
|
||||
@@ -137,6 +148,7 @@ public interface RedisClusterCommands {
|
||||
*
|
||||
* @param node must contain {@link RedisClusterNode#getHost() host} and {@link RedisClusterNode#getPort()} and must
|
||||
* not be {@literal null}.
|
||||
* @see <a href="https://redis.io/commands/cluster-meet">Redis Documentation: CLUSTER MEET</a>
|
||||
*/
|
||||
void clusterMeet(RedisClusterNode node);
|
||||
|
||||
@@ -144,6 +156,7 @@ public interface RedisClusterCommands {
|
||||
* @param node must not be {@literal null}.
|
||||
* @param slot
|
||||
* @param mode must not be{@literal null}.
|
||||
* @see <a href="https://redis.io/commands/cluster-setslot">Redis Documentation: CLUSTER SETSLOT</a>
|
||||
*/
|
||||
void clusterSetSlot(RedisClusterNode node, int slot, AddSlots mode);
|
||||
|
||||
@@ -153,6 +166,7 @@ public interface RedisClusterCommands {
|
||||
* @param slot
|
||||
* @param count must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="https://redis.io/commands/cluster-getkeysinslot">Redis Documentation: CLUSTER GETKEYSINSLOT</a>
|
||||
*/
|
||||
List<byte[]> clusterGetKeysInSlot(int slot, Integer count);
|
||||
|
||||
@@ -161,6 +175,7 @@ public interface RedisClusterCommands {
|
||||
*
|
||||
* @param master must not be {@literal null}.
|
||||
* @param slave must not be {@literal null}.
|
||||
* @see <a href="https://redis.io/commands/cluster-replicate">Redis Documentation: CLUSTER REPLICATE</a>
|
||||
*/
|
||||
void clusterReplicate(RedisClusterNode master, RedisClusterNode slave);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2014 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,34 +20,32 @@ package org.springframework.data.redis.connection;
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface RedisConnectionCommands {
|
||||
|
||||
/**
|
||||
* Select the DB with given positive {@code dbIndex}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/select
|
||||
*
|
||||
* @param dbIndex
|
||||
*
|
||||
* @param dbIndex the database index.
|
||||
* @see <a href="http://redis.io/commands/select">Redis Documentation: SELECT</a>
|
||||
*/
|
||||
void select(int dbIndex);
|
||||
|
||||
/**
|
||||
* Returns {@code message} via server roundtrip.
|
||||
* <p>
|
||||
* See http://redis.io/commands/echo
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* @param message the message to echo.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/echo">Redis Documentation: ECHO</a>
|
||||
*/
|
||||
byte[] echo(byte[] message);
|
||||
|
||||
/**
|
||||
* Test connection.
|
||||
* <p>
|
||||
* See http://redis.io/commands/ping
|
||||
*
|
||||
*
|
||||
* @return Server response message - usually {@literal PONG}.
|
||||
* @see <a href="http://redis.io/commands/ping">Redis Documentation: PING</a>
|
||||
*/
|
||||
String ping();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,9 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -28,14 +31,12 @@ import org.springframework.data.geo.Metric;
|
||||
import org.springframework.data.geo.Point;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* Geo-specific Redis commands.
|
||||
*
|
||||
* @author Ninad Divadkar
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface RedisGeoCommands {
|
||||
@@ -47,7 +48,7 @@ public interface RedisGeoCommands {
|
||||
* @param point must not be {@literal null}.
|
||||
* @param member must not be {@literal null}.
|
||||
* @return Number of elements added.
|
||||
* @see <a href="http://redis.io/commands/geoadd">http://redis.io/commands/geoadd</a>
|
||||
* @see <a href="http://redis.io/commands/geoadd">Redis Documentation: GEOADD</a>
|
||||
*/
|
||||
Long geoAdd(byte[] key, Point point, byte[] member);
|
||||
|
||||
@@ -57,7 +58,7 @@ public interface RedisGeoCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param location must not be {@literal null}.
|
||||
* @return Number of elements added.
|
||||
* @see <a href="http://redis.io/commands/geoadd">http://redis.io/commands/geoadd</a>
|
||||
* @see <a href="http://redis.io/commands/geoadd">Redis Documentation: GEOADD</a>
|
||||
*/
|
||||
Long geoAdd(byte[] key, GeoLocation<byte[]> location);
|
||||
|
||||
@@ -67,7 +68,7 @@ public interface RedisGeoCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param memberCoordinateMap must not be {@literal null}.
|
||||
* @return Number of elements added.
|
||||
* @see <a href="http://redis.io/commands/geoadd">http://redis.io/commands/geoadd</a>
|
||||
* @see <a href="http://redis.io/commands/geoadd">Redis Documentation: GEOADD</a>
|
||||
*/
|
||||
Long geoAdd(byte[] key, Map<byte[], Point> memberCoordinateMap);
|
||||
|
||||
@@ -77,7 +78,7 @@ public interface RedisGeoCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param locations must not be {@literal null}.
|
||||
* @return Number of elements added.
|
||||
* @see <a href="http://redis.io/commands/geoadd">http://redis.io/commands/geoadd</a>
|
||||
* @see <a href="http://redis.io/commands/geoadd">Redis Documentation: GEOADD</a>
|
||||
*/
|
||||
Long geoAdd(byte[] key, Iterable<GeoLocation<byte[]>> locations);
|
||||
|
||||
@@ -88,7 +89,7 @@ public interface RedisGeoCommands {
|
||||
* @param member1 must not be {@literal null}.
|
||||
* @param member2 must not be {@literal null}.
|
||||
* @return can be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/geodist">http://redis.io/commands/geodist</a>
|
||||
* @see <a href="http://redis.io/commands/geodist">Redis Documentation: GEODIST</a>
|
||||
*/
|
||||
Distance geoDist(byte[] key, byte[] member1, byte[] member2);
|
||||
|
||||
@@ -100,7 +101,7 @@ public interface RedisGeoCommands {
|
||||
* @param member2 must not be {@literal null}.
|
||||
* @param metric must not be {@literal null}.
|
||||
* @return can be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/geodist">http://redis.io/commands/geodist</a>
|
||||
* @see <a href="http://redis.io/commands/geodist">Redis Documentation: GEODIST</a>
|
||||
*/
|
||||
Distance geoDist(byte[] key, byte[] member1, byte[] member2, Metric metric);
|
||||
|
||||
@@ -110,7 +111,7 @@ public interface RedisGeoCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param members must not be {@literal null}.
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/geohash">http://redis.io/commands/geohash</a>
|
||||
* @see <a href="http://redis.io/commands/geohash">Redis Documentation: GEOHASH</a>
|
||||
*/
|
||||
List<String> geoHash(byte[] key, byte[]... members);
|
||||
|
||||
@@ -120,7 +121,7 @@ public interface RedisGeoCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param members must not be {@literal null}.
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/geopos">http://redis.io/commands/geopos</a>
|
||||
* @see <a href="http://redis.io/commands/geopos">Redis Documentation: GEOPOS</a>
|
||||
*/
|
||||
List<Point> geoPos(byte[] key, byte[]... members);
|
||||
|
||||
@@ -130,7 +131,7 @@ public interface RedisGeoCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param within must not be {@literal null}.
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/georadius">http://redis.io/commands/georadius</a>
|
||||
* @see <a href="http://redis.io/commands/georadius">Redis Documentation: GEORADIUS</a>
|
||||
*/
|
||||
GeoResults<GeoLocation<byte[]>> geoRadius(byte[] key, Circle within);
|
||||
|
||||
@@ -141,7 +142,7 @@ public interface RedisGeoCommands {
|
||||
* @param within must not be {@literal null}.
|
||||
* @param args must not be {@literal null}.
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/georadius">http://redis.io/commands/georadius</a>
|
||||
* @see <a href="http://redis.io/commands/georadius">Redis Documentation: GEORADIUS</a>
|
||||
*/
|
||||
GeoResults<GeoLocation<byte[]>> geoRadius(byte[] key, Circle within, GeoRadiusCommandArgs args);
|
||||
|
||||
@@ -153,7 +154,7 @@ public interface RedisGeoCommands {
|
||||
* @param member must not be {@literal null}.
|
||||
* @param radius
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/georadiusbymember">http://redis.io/commands/georadiusbymember</a>
|
||||
* @see <a href="http://redis.io/commands/georadiusbymember">Redis Documentation: GEORADIUSBYMEMBER</a>
|
||||
*/
|
||||
GeoResults<GeoLocation<byte[]>> geoRadiusByMember(byte[] key, byte[] member, double radius);
|
||||
|
||||
@@ -165,7 +166,7 @@ public interface RedisGeoCommands {
|
||||
* @param member must not be {@literal null}.
|
||||
* @param radius must not be {@literal null}.
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/georadiusbymember">http://redis.io/commands/georadiusbymember</a>
|
||||
* @see <a href="http://redis.io/commands/georadiusbymember">Redis Documentation: GEORADIUSBYMEMBER</a>
|
||||
*/
|
||||
GeoResults<GeoLocation<byte[]>> geoRadiusByMember(byte[] key, byte[] member, Distance radius);
|
||||
|
||||
@@ -178,7 +179,7 @@ public interface RedisGeoCommands {
|
||||
* @param radius must not be {@literal null}.
|
||||
* @param args must not be {@literal null}.
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/georadiusbymember">http://redis.io/commands/georadiusbymember</a>
|
||||
* @see <a href="http://redis.io/commands/georadiusbymember">Redis Documentation: GEORADIUSBYMEMBER</a>
|
||||
*/
|
||||
GeoResults<GeoLocation<byte[]>> geoRadiusByMember(byte[] key, byte[] member, Distance radius,
|
||||
GeoRadiusCommandArgs args);
|
||||
@@ -189,6 +190,7 @@ public interface RedisGeoCommands {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param members must not be {@literal null}.
|
||||
* @return Number of elements removed.
|
||||
* @see <a href="http://redis.io/commands/zrem">Redis Documentation: ZREM</a>
|
||||
*/
|
||||
Long geoRemove(byte[] key, byte[]... members);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2014 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,146 +27,147 @@ import org.springframework.data.redis.core.ScanOptions;
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface RedisHashCommands {
|
||||
|
||||
/**
|
||||
* Set the {@code value} of a hash {@code field}.
|
||||
*
|
||||
* @see http://redis.io/commands/hset
|
||||
* @param key
|
||||
* @param field
|
||||
* @param key must not be {@literal null}.
|
||||
* @param field must not be {@literal null}.
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hset">Redis Documentation: HSET</a>
|
||||
*/
|
||||
Boolean hSet(byte[] key, byte[] field, byte[] value);
|
||||
|
||||
/**
|
||||
* Set the {@code value} of a hash {@code field} only if {@code field} does not exist.
|
||||
*
|
||||
* @see http://redis.io/commands/hsetnx
|
||||
* @param key
|
||||
* @param field
|
||||
* @param key must not be {@literal null}.
|
||||
* @param field must not be {@literal null}.
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hsetnx">Redis Documentation: HSETNX</a>
|
||||
*/
|
||||
Boolean hSetNX(byte[] key, byte[] field, byte[] value);
|
||||
|
||||
/**
|
||||
* Get value for given {@code field} from hash at {@code key}.
|
||||
*
|
||||
* @see http://redis.io/commands/hget
|
||||
* @param key
|
||||
* @param field
|
||||
* @param key must not be {@literal null}.
|
||||
* @param field must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hget">Redis Documentation: HGET</a>
|
||||
*/
|
||||
byte[] hGet(byte[] key, byte[] field);
|
||||
|
||||
/**
|
||||
* Get values for given {@code fields} from hash at {@code key}.
|
||||
*
|
||||
* @see http://redis.io/commands/hmget
|
||||
* @param key
|
||||
* @param fields
|
||||
* @param key must not be {@literal null}.
|
||||
* @param fields must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hmget">Redis Documentation: HMGET</a>
|
||||
*/
|
||||
List<byte[]> hMGet(byte[] key, byte[]... fields);
|
||||
|
||||
/**
|
||||
* Set multiple hash fields to multiple values using data provided in {@code hashes}
|
||||
*
|
||||
* @see http://redis.io/commands/hmset
|
||||
* @param key
|
||||
* @param hashes
|
||||
* @param key must not be {@literal null}.
|
||||
* @param hashes must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/hmset">Redis Documentation: HMSET</a>
|
||||
*/
|
||||
void hMSet(byte[] key, Map<byte[], byte[]> hashes);
|
||||
|
||||
/**
|
||||
* Increment {@code value} of a hash {@code field} by the given {@code delta}.
|
||||
*
|
||||
* @see http://redis.io/commands/hincrby
|
||||
* @param key
|
||||
* @param field
|
||||
* @param key must not be {@literal null}.
|
||||
* @param field must not be {@literal null}.
|
||||
* @param delta
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hincrby">Redis Documentation: HINCRBY</a>
|
||||
*/
|
||||
Long hIncrBy(byte[] key, byte[] field, long delta);
|
||||
|
||||
/**
|
||||
* Increment {@code value} of a hash {@code field} by the given {@code delta}.
|
||||
*
|
||||
* @see http://redis.io/commands/hincrbyfloat
|
||||
* @param key
|
||||
* @param key must not be {@literal null}.
|
||||
* @param field
|
||||
* @param delta
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hincrbyfloat">Redis Documentation: HINCRBYFLOAT</a>
|
||||
*/
|
||||
Double hIncrBy(byte[] key, byte[] field, double delta);
|
||||
|
||||
/**
|
||||
* Determine if given hash {@code field} exists.
|
||||
*
|
||||
* @see http://redis.io/commands/hexits
|
||||
* @param key
|
||||
* @param field
|
||||
* @param key must not be {@literal null}.
|
||||
* @param field must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hexits">Redis Documentation: HEXISTS</a>
|
||||
*/
|
||||
Boolean hExists(byte[] key, byte[] field);
|
||||
|
||||
/**
|
||||
* Delete given hash {@code fields}.
|
||||
*
|
||||
* @see http://redis.io/commands/hdel
|
||||
* @param key
|
||||
* @param fields
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param fields must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hdel">Redis Documentation: HDEL</a>
|
||||
*/
|
||||
Long hDel(byte[] key, byte[]... fields);
|
||||
|
||||
/**
|
||||
* Get size of hash at {@code key}.
|
||||
*
|
||||
* @see http://redis.io/commands/hlen
|
||||
* @param key
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hlen">Redis Documentation: HLEN</a>
|
||||
*/
|
||||
Long hLen(byte[] key);
|
||||
|
||||
/**
|
||||
* Get key set (fields) of hash at {@code key}.
|
||||
*
|
||||
* @see http://redis.io/commands/h?
|
||||
* @param key
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hkeys">Redis Documentation: HKEYS</a>?
|
||||
*/
|
||||
Set<byte[]> hKeys(byte[] key);
|
||||
|
||||
/**
|
||||
* Get entry set (values) of hash at {@code field}.
|
||||
*
|
||||
* @see http://redis.io/commands/hvals
|
||||
* @param key
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hvals">Redis Documentation: HVALS</a>
|
||||
*/
|
||||
List<byte[]> hVals(byte[] key);
|
||||
|
||||
/**
|
||||
* Get entire hash stored at {@code key}.
|
||||
*
|
||||
* @see http://redis.io/commands/hgetall
|
||||
* @param key
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/hgetall">Redis Documentation: HGETALL</a>
|
||||
*/
|
||||
Map<byte[], byte[]> hGetAll(byte[] key);
|
||||
|
||||
/**
|
||||
* Use a {@link Cursor} to iterate over entries in hash at {@code key}.
|
||||
*
|
||||
* @since 1.4
|
||||
* @see http://redis.io/commands/scan
|
||||
* @param key
|
||||
* @param options
|
||||
* @param key must not be {@literal null}.
|
||||
* @param options must not be {@literal null}.
|
||||
* @return
|
||||
* @since 1.4
|
||||
* @see <a href="http://redis.io/commands/hscan">Redis Documentation: HSCAN</a>
|
||||
*/
|
||||
Cursor<Map.Entry<byte[], byte[]>> hScan(byte[] key, ScanOptions options);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2016 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,235 +33,213 @@ public interface RedisKeyCommands {
|
||||
|
||||
/**
|
||||
* Determine if given {@code key} exists.
|
||||
* <p>
|
||||
* See http://redis.io/commands/exists
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/exists">Redis Documentation: EXISTS</a>
|
||||
*/
|
||||
Boolean exists(byte[] key);
|
||||
|
||||
/**
|
||||
* Delete given {@code keys}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/del
|
||||
*
|
||||
* @param keys
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return The number of keys that were removed.
|
||||
* @see <a href="http://redis.io/commands/del">Redis Documentation: DEL</a>
|
||||
*/
|
||||
Long del(byte[]... keys);
|
||||
|
||||
/**
|
||||
* Determine the type stored at {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/type
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/type">Redis Documentation: TYPE</a>
|
||||
*/
|
||||
DataType type(byte[] key);
|
||||
|
||||
/**
|
||||
* Find all keys matching the given {@code pattern}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/keys
|
||||
*
|
||||
* @param pattern
|
||||
*
|
||||
* @param pattern must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/keys">Redis Documentation: KEYS</a>
|
||||
*/
|
||||
Set<byte[]> keys(byte[] pattern);
|
||||
|
||||
/**
|
||||
* Use a {@link Cursor} to iterate over keys.
|
||||
* <p>
|
||||
* See http://redis.io/commands/scan
|
||||
*
|
||||
* @param options
|
||||
*
|
||||
* @param options must not be {@literal null}.
|
||||
* @return
|
||||
* @since 1.4
|
||||
* @see <a href="http://redis.io/commands/scan">Redis Documentation: SCAN</a>
|
||||
*/
|
||||
Cursor<byte[]> scan(ScanOptions options);
|
||||
|
||||
/**
|
||||
* Return a random key from the keyspace.
|
||||
* <p>
|
||||
* See http://redis.io/commands/randomkey
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/randomkey">Redis Documentation: RANDOMKEY</a>
|
||||
*/
|
||||
byte[] randomKey();
|
||||
|
||||
/**
|
||||
* Rename key {@code oleName} to {@code newName}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/rename
|
||||
*
|
||||
* @param oldName
|
||||
* @param newName
|
||||
* Rename key {@code oldName} to {@code newName}.
|
||||
*
|
||||
* @param oldName must not be {@literal null}.
|
||||
* @param newName must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/rename">Redis Documentation: RENAME</a>
|
||||
*/
|
||||
void rename(byte[] oldName, byte[] newName);
|
||||
|
||||
/**
|
||||
* Rename key {@code oleName} to {@code newName} only if {@code newName} does not exist.
|
||||
* <p>
|
||||
* See http://redis.io/commands/renamenx
|
||||
*
|
||||
* @param oldName
|
||||
* @param newName
|
||||
* Rename key {@code oldName} to {@code newName} only if {@code newName} does not exist.
|
||||
*
|
||||
* @param oldName must not be {@literal null}.
|
||||
* @param newName must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/renamenx">Redis Documentation: RENAMENX</a>
|
||||
*/
|
||||
Boolean renameNX(byte[] oldName, byte[] newName);
|
||||
|
||||
/**
|
||||
* Set time to live for given {@code key} in seconds.
|
||||
* <p>
|
||||
* See http://redis.io/commands/expire
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param seconds
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/expire">Redis Documentation: EXPIRE</a>
|
||||
*/
|
||||
Boolean expire(byte[] key, long seconds);
|
||||
|
||||
/**
|
||||
* Set time to live for given {@code key} in milliseconds.
|
||||
* <p>
|
||||
* See http://redis.io/commands/pexpire
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param millis
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/pexpire">Redis Documentation: PEXPIRE</a>
|
||||
*/
|
||||
Boolean pExpire(byte[] key, long millis);
|
||||
|
||||
/**
|
||||
* Set the expiration for given {@code key} as a {@literal UNIX} timestamp.
|
||||
* <p>
|
||||
* See http://redis.io/commands/expireat
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param unixTime
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/expireat">Redis Documentation: EXPIREAT</a>
|
||||
*/
|
||||
Boolean expireAt(byte[] key, long unixTime);
|
||||
|
||||
/**
|
||||
* Set the expiration for given {@code key} as a {@literal UNIX} timestamp in milliseconds.
|
||||
* <p>
|
||||
* See http://redis.io/commands/pexpireat
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param unixTimeInMillis
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/pexpireat">Redis Documentation: PEXPIREAT</a>
|
||||
*/
|
||||
Boolean pExpireAt(byte[] key, long unixTimeInMillis);
|
||||
|
||||
/**
|
||||
* Remove the expiration from given {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/persist
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/persist">Redis Documentation: PERSIST</a>
|
||||
*/
|
||||
Boolean persist(byte[] key);
|
||||
|
||||
/**
|
||||
* Move given {@code key} to database with {@code index}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/move
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param dbIndex
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/move">Redis Documentation: MOVE</a>
|
||||
*/
|
||||
Boolean move(byte[] key, int dbIndex);
|
||||
|
||||
/**
|
||||
* Get the time to live for {@code key} in seconds.
|
||||
* <p>
|
||||
* See http://redis.io/commands/ttl
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/ttl">Redis Documentation: TTL</a>
|
||||
*/
|
||||
Long ttl(byte[] key);
|
||||
|
||||
/**
|
||||
* Get the time to live for {@code key} in and convert it to the given {@link TimeUnit}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/ttl
|
||||
*
|
||||
* @param key
|
||||
* @param timeUnit
|
||||
* @param key must not be {@literal null}.
|
||||
* @param timeUnit must not be {@literal null}.
|
||||
* @return
|
||||
* @since 1.8
|
||||
* @see <a href="http://redis.io/commands/ttl">Redis Documentation: TTL</a>
|
||||
*/
|
||||
Long ttl(byte[] key, TimeUnit timeUnit);
|
||||
|
||||
/**
|
||||
* Get the precise time to live for {@code key} in milliseconds.
|
||||
* <p>
|
||||
* See http://redis.io/commands/pttl
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/pttl">Redis Documentation: PTTL</a>
|
||||
*/
|
||||
Long pTtl(byte[] key);
|
||||
|
||||
/**
|
||||
* Get the precise time to live for {@code key} in and convert it to the given {@link TimeUnit}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/pttl
|
||||
*
|
||||
* @param key
|
||||
* @param timeUnit
|
||||
* @param key must not be {@literal null}.
|
||||
* @param timeUnit must not be {@literal null}.
|
||||
* @return
|
||||
* @since 1.8
|
||||
* @see <a href="http://redis.io/commands/pttl">Redis Documentation: PTTL</a>
|
||||
*/
|
||||
Long pTtl(byte[] key, TimeUnit timeUnit);
|
||||
|
||||
/**
|
||||
* Sort the elements for {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/sort
|
||||
*
|
||||
* @param key
|
||||
* @param params
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param params must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sort">Redis Documentation: SORT</a>
|
||||
*/
|
||||
List<byte[]> sort(byte[] key, SortParameters params);
|
||||
|
||||
/**
|
||||
* Sort the elements for {@code key} and store result in {@code storeKey}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/sort
|
||||
*
|
||||
* @param key
|
||||
* @param params
|
||||
* @param storeKey
|
||||
* @return
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param params must not be {@literal null}.
|
||||
* @param storeKey must not be {@literal null}.
|
||||
* @return number of values.
|
||||
* @see <a href="http://redis.io/commands/sort">Redis Documentation: SORT</a>
|
||||
*/
|
||||
Long sort(byte[] key, SortParameters params, byte[] storeKey);
|
||||
|
||||
/**
|
||||
* Retrieve serialized version of the value stored at {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/dump
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/dump">Redis Documentation: DUMP</a>
|
||||
*/
|
||||
byte[] dump(byte[] key);
|
||||
|
||||
/**
|
||||
* Create {@code key} using the {@code serializedValue}, previously obtained using {@link #dump(byte[])}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/restore
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param ttlInMillis
|
||||
* @param serializedValue
|
||||
* @param serializedValue must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/restore">Redis Documentation: RESTORE</a>
|
||||
*/
|
||||
void restore(byte[] key, long ttlInMillis, byte[] serializedValue);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2014 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,6 +22,7 @@ import java.util.List;
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface RedisListCommands {
|
||||
|
||||
@@ -34,194 +35,180 @@ public interface RedisListCommands {
|
||||
|
||||
/**
|
||||
* Append {@code values} to {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/rpush
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param values
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/rpush">Redis Documentation: RPUSH</a>
|
||||
*/
|
||||
Long rPush(byte[] key, byte[]... values);
|
||||
|
||||
/**
|
||||
* Prepend {@code values} to {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/lpush
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param values
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lpush">Redis Documentation: LPUSH</a>
|
||||
*/
|
||||
Long lPush(byte[] key, byte[]... values);
|
||||
|
||||
/**
|
||||
* Append {@code} values to {@code key} only if the list exists.
|
||||
* <p>
|
||||
* See http://redis.io/commands/rpushx
|
||||
*
|
||||
* @param key
|
||||
* Append {@code values} to {@code key} only if the list exists.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/rpushx">Redis Documentation: RPUSHX</a>
|
||||
*/
|
||||
Long rPushX(byte[] key, byte[] value);
|
||||
|
||||
/**
|
||||
* Prepend {@code values} to {@code key} only if the list exists.
|
||||
* <p>
|
||||
* See http://redis.io/commands/lpushx
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lpushx">Redis Documentation: LPUSHX</a>
|
||||
*/
|
||||
Long lPushX(byte[] key, byte[] value);
|
||||
|
||||
/**
|
||||
* Get the size of list stored at {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/llen
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/llen">Redis Documentation: LLEN</a>
|
||||
*/
|
||||
Long lLen(byte[] key);
|
||||
|
||||
/**
|
||||
* Get elements between {@code begin} and {@code end} from list at {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/lrange
|
||||
*
|
||||
* @param key
|
||||
* @param begin
|
||||
* Get elements between {@code start} and {@code end} from list at {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lrange">Redis Documentation: LRANGE</a>
|
||||
*/
|
||||
List<byte[]> lRange(byte[] key, long begin, long end);
|
||||
List<byte[]> lRange(byte[] key, long start, long end);
|
||||
|
||||
/**
|
||||
* Trim list at {@code key} to elements between {@code begin} and {@code end}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/ltrim
|
||||
*
|
||||
* @param key
|
||||
* @param begin
|
||||
* Trim list at {@code key} to elements between {@code start} and {@code end}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param start
|
||||
* @param end
|
||||
* @see <a href="http://redis.io/commands/ltrim">Redis Documentation: LTRIM</a>
|
||||
*/
|
||||
void lTrim(byte[] key, long begin, long end);
|
||||
void lTrim(byte[] key, long start, long end);
|
||||
|
||||
/**
|
||||
* Get element at {@code index} form list at {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/lindex
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param index
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lindex">Redis Documentation: LINDEX</a>
|
||||
*/
|
||||
byte[] lIndex(byte[] key, long index);
|
||||
|
||||
/**
|
||||
* Insert {@code value} {@link Position#BEFORE} or {@link Position#AFTER} existing {@code pivot} for {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/linsert
|
||||
*
|
||||
* @param key
|
||||
* @param where
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param where must not be {@literal null}.
|
||||
* @param pivot
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/linsert">Redis Documentation: LINSERT</a>
|
||||
*/
|
||||
Long lInsert(byte[] key, Position where, byte[] pivot, byte[] value);
|
||||
|
||||
/**
|
||||
* Set the {@code value} list element at {@code index}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/lset
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param index
|
||||
* @param value
|
||||
* @see <a href="http://redis.io/commands/lset">Redis Documentation: LSET</a>
|
||||
*/
|
||||
void lSet(byte[] key, long index, byte[] value);
|
||||
|
||||
/**
|
||||
* Removes the first {@code count} occurrences of {@code value} from the list stored at {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/lrem
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param count
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lrem">Redis Documentation: LREM</a>
|
||||
*/
|
||||
Long lRem(byte[] key, long count, byte[] value);
|
||||
|
||||
/**
|
||||
* Removes and returns first element in list stored at {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/lpop
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lpop">Redis Documentation: LPOP</a>
|
||||
*/
|
||||
byte[] lPop(byte[] key);
|
||||
|
||||
/**
|
||||
* Removes and returns last element in list stored at {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/rpop
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/rpop">Redis Documentation: RPOP</a>
|
||||
*/
|
||||
byte[] rPop(byte[] key);
|
||||
|
||||
/**
|
||||
* Removes and returns first element from lists stored at {@code keys} (see: {@link #lPop(byte[])}). <br>
|
||||
* Removes and returns first element from lists stored at {@code keys}. <br>
|
||||
* <b>Blocks connection</b> until element available or {@code timeout} reached.
|
||||
* <p>
|
||||
* See http://redis.io/commands/blpop
|
||||
*
|
||||
*
|
||||
* @param timeout
|
||||
* @param keys
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/blpop">Redis Documentation: BLPOP</a>
|
||||
* @see #lPop(byte[])
|
||||
*/
|
||||
List<byte[]> bLPop(int timeout, byte[]... keys);
|
||||
|
||||
/**
|
||||
* Removes and returns last element from lists stored at {@code keys} (see: {@link #rPop(byte[])}). <br>
|
||||
* Removes and returns last element from lists stored at {@code keys}. <br>
|
||||
* <b>Blocks connection</b> until element available or {@code timeout} reached.
|
||||
* <p>
|
||||
* See http://redis.io/commands/brpop
|
||||
*
|
||||
*
|
||||
* @param timeout
|
||||
* @param keys
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/brpop">Redis Documentation: BRPOP</a>
|
||||
* @see #rPop(byte[])
|
||||
*/
|
||||
List<byte[]> bRPop(int timeout, byte[]... keys);
|
||||
|
||||
/**
|
||||
* Remove the last element from list at {@code srcKey}, append it to {@code dstKey} and return its value.
|
||||
* <p>
|
||||
* See http://redis.io/commands/rpoplpush
|
||||
*
|
||||
* @param srcKey
|
||||
* @param dstKey
|
||||
*
|
||||
* @param srcKey must not be {@literal null}.
|
||||
* @param dstKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/rpoplpush">Redis Documentation: RPOPLPUSH</a>
|
||||
*/
|
||||
byte[] rPopLPush(byte[] srcKey, byte[] dstKey);
|
||||
|
||||
/**
|
||||
* Remove the last element from list at {@code srcKey}, append it to {@code dstKey} and return its value (see
|
||||
* {@link #rPopLPush(byte[], byte[])}). <br>
|
||||
* Remove the last element from list at {@code srcKey}, append it to {@code dstKey} and return its value.
|
||||
* <br>
|
||||
* <b>Blocks connection</b> until element available or {@code timeout} reached.
|
||||
* <p>
|
||||
* See http://redis.io/commands/brpoplpush
|
||||
*
|
||||
*
|
||||
* @param timeout
|
||||
* @param srcKey
|
||||
* @param dstKey
|
||||
* @param srcKey must not be {@literal null}.
|
||||
* @param dstKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/brpoplpush">Redis Documentation: BRPOPLPUSH</a>
|
||||
* @see #rPopLPush(byte[], byte[])
|
||||
*/
|
||||
byte[] bRPopLPush(int timeout, byte[] srcKey, byte[] dstKey);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2013 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,7 @@ package org.springframework.data.redis.connection;
|
||||
* PubSub-specific Redis commands.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface RedisPubSubCommands {
|
||||
|
||||
@@ -39,9 +40,10 @@ public interface RedisPubSubCommands {
|
||||
/**
|
||||
* Publishes the given message to the given channel.
|
||||
*
|
||||
* @param channel the channel to publish to
|
||||
* @param channel the channel to publish to, must not be {@literal null}.
|
||||
* @param message message to publish
|
||||
* @return the number of clients that received the message
|
||||
* @see <a href="http://redis.io/commands/publish">Redis Documentation: PUBLISH</a>
|
||||
*/
|
||||
Long publish(byte[] channel, byte[] message);
|
||||
|
||||
@@ -51,8 +53,9 @@ public interface RedisPubSubCommands {
|
||||
* <p>
|
||||
* Note that this operation is blocking and the current thread starts waiting for new messages immediately.
|
||||
*
|
||||
* @param listener message listener
|
||||
* @param channels channel names
|
||||
* @param listener message listener, must not be {@literal null}.
|
||||
* @param channels channel names, must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/subscribe">Redis Documentation: SUBSCRIBE</a>
|
||||
*/
|
||||
void subscribe(MessageListener listener, byte[]... channels);
|
||||
|
||||
@@ -63,8 +66,9 @@ public interface RedisPubSubCommands {
|
||||
* <p>
|
||||
* Note that this operation is blocking and the current thread starts waiting for new messages immediately.
|
||||
*
|
||||
* @param listener message listener
|
||||
* @param patterns channel name patterns
|
||||
* @param listener message listener, must not be {@literal null}.
|
||||
* @param patterns channel name patterns, must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/psubscribe">Redis Documentation: PSUBSCRIBE</a>
|
||||
*/
|
||||
void pSubscribe(MessageListener listener, byte[]... patterns);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,81 +23,77 @@ import java.util.List;
|
||||
* @author Costin Leau
|
||||
* @author Christoph Strobl
|
||||
* @author David Liu
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface RedisScriptingCommands {
|
||||
|
||||
/**
|
||||
* Flush lua script cache.
|
||||
* <p>
|
||||
* See http://redis.io/commands/script-flush
|
||||
*
|
||||
* @see <a href="http://redis.io/commands/script-flush">Redis Documentation: SCRIPT FLUSH</a>
|
||||
*/
|
||||
void scriptFlush();
|
||||
|
||||
/**
|
||||
* Kill current lua script execution.
|
||||
* <p>
|
||||
* See http://redis.io/commands/script-kill
|
||||
*
|
||||
* @see <a href="http://redis.io/commands/script-kill">Redis Documentation: SCRIPT KILL</a>
|
||||
*/
|
||||
void scriptKill();
|
||||
|
||||
/**
|
||||
* Load lua script into scripts cache, without executing it.<br>
|
||||
* Execute the script by calling {@link #evalSha(String, ReturnType, int, byte[])}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/script-load
|
||||
*
|
||||
* @param script
|
||||
* Execute the script by calling {@link #evalSha(byte[], ReturnType, int, byte[]...)}.
|
||||
*
|
||||
* @param script must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/script-load">Redis Documentation: SCRIPT LOAD</a>
|
||||
*/
|
||||
String scriptLoad(byte[] script);
|
||||
|
||||
/**
|
||||
* Check if given {@code scriptShas} exist in script cache.
|
||||
* <p>
|
||||
* See http://redis.io/commands/script-exits
|
||||
*
|
||||
*
|
||||
* @param scriptShas
|
||||
* @return one entry per given scriptSha in returned list.
|
||||
* @see <a href="http://redis.io/commands/script-exists">Redis Documentation: SCRIPT EXISTS</a>
|
||||
*/
|
||||
List<Boolean> scriptExists(String... scriptShas);
|
||||
|
||||
/**
|
||||
* Evaluate given {@code script}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/eval
|
||||
*
|
||||
* @param script
|
||||
* @param returnType
|
||||
*
|
||||
* @param script must not be {@literal null}.
|
||||
* @param returnType must not be {@literal null}.
|
||||
* @param numKeys
|
||||
* @param keysAndArgs
|
||||
* @param keysAndArgs must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/eval">Redis Documentation: EVAL</a>
|
||||
*/
|
||||
<T> T eval(byte[] script, ReturnType returnType, int numKeys, byte[]... keysAndArgs);
|
||||
|
||||
/**
|
||||
* Evaluate given {@code scriptSha}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/evalsha
|
||||
*
|
||||
* @param scriptSha
|
||||
* @param returnType
|
||||
*
|
||||
* @param scriptSha must not be {@literal null}.
|
||||
* @param returnType must not be {@literal null}.
|
||||
* @param numKeys
|
||||
* @param keysAndArgs
|
||||
* @param keysAndArgs must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/evalsha">Redis Documentation: EVALSHA</a>
|
||||
*/
|
||||
<T> T evalSha(String scriptSha, ReturnType returnType, int numKeys, byte[]... keysAndArgs);
|
||||
|
||||
/**
|
||||
* Evaluate given {@code scriptSha}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/evalsha
|
||||
*
|
||||
* @param scriptSha
|
||||
* @param returnType
|
||||
*
|
||||
* @param scriptSha must not be {@literal null}.
|
||||
* @param returnType must not be {@literal null}.
|
||||
* @param numKeys
|
||||
* @param keysAndArgs
|
||||
* @param keysAndArgs must not be {@literal null}.
|
||||
* @return
|
||||
* @since 1.5
|
||||
* @see <a href="http://redis.io/commands/evalsha">Redis Documentation: EVALSHA</a>
|
||||
*/
|
||||
<T> T evalSha(byte[] scriptSha, ReturnType returnType, int numKeys, byte[]... keysAndArgs);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,8 +18,12 @@ package org.springframework.data.redis.connection;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Redis Sentinel-specific commands.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @since 1.4
|
||||
* @see <a href="https://redis.io/topics/sentinel">Redis Sentinel Documentation</a>
|
||||
*/
|
||||
public interface RedisSentinelCommands {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2014 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,6 +26,7 @@ import org.springframework.data.redis.core.types.RedisClientInfo;
|
||||
* @author Costin Leau
|
||||
* @author Christoph Strobl
|
||||
* @author Thomas Darimont
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface RedisServerCommands {
|
||||
|
||||
@@ -42,133 +43,125 @@ public interface RedisServerCommands {
|
||||
|
||||
/**
|
||||
* Start an {@literal Append Only File} rewrite process on server.
|
||||
* <p>
|
||||
* See http://redis.io/commands/bgrewriteaof
|
||||
*
|
||||
* @deprecated As of 1.3, use {@link #bgReWriteAof}.
|
||||
* @see <a href="http://redis.io/commands/bgrewriteaof">Redis Documentation: BGREWRITEAOF</a>
|
||||
*/
|
||||
@Deprecated
|
||||
void bgWriteAof();
|
||||
|
||||
/**
|
||||
* Start an {@literal Append Only File} rewrite process on server.
|
||||
* <p>
|
||||
* See http://redis.io/commands/bgrewriteaof
|
||||
*
|
||||
*
|
||||
* @since 1.3
|
||||
* @see <a href="http://redis.io/commands/bgrewriteaof">Redis Documentation: BGREWRITEAOF</a>
|
||||
*/
|
||||
void bgReWriteAof();
|
||||
|
||||
/**
|
||||
* Start background saving of db on server.
|
||||
* <p>
|
||||
* See http://redis.io/commands/bgsave
|
||||
*
|
||||
* @see <a href="http://redis.io/commands/bgsave">Redis Documentation: BGSAVE</a>
|
||||
*/
|
||||
void bgSave();
|
||||
|
||||
/**
|
||||
* Get time of last {@link #bgSave()} operation in seconds.
|
||||
* <p>
|
||||
* See http://redis.io/commands/lastsave
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lastsave">Redis Documentation: LASTSAVE</a>
|
||||
*/
|
||||
Long lastSave();
|
||||
|
||||
/**
|
||||
* Synchronous save current db snapshot on server.
|
||||
* <p>
|
||||
* See http://redis.io/commands/save
|
||||
*
|
||||
* @see <a href="http://redis.io/commands/save">Redis Documentation: SAVE</a>
|
||||
*/
|
||||
void save();
|
||||
|
||||
/**
|
||||
* Get the total number of available keys in currently selected database.
|
||||
* <p>
|
||||
* See http://redis.io/commands/dbsize
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/dbsize">Redis Documentation: DBSIZE</a>
|
||||
*/
|
||||
Long dbSize();
|
||||
|
||||
/**
|
||||
* Delete all keys of the currently selected database.
|
||||
* <p>
|
||||
* See http://redis.io/commands/flushdb
|
||||
*
|
||||
* @see <a href="http://redis.io/commands/flushdb">Redis Documentation: FLUSHDB</a>
|
||||
*/
|
||||
void flushDb();
|
||||
|
||||
/**
|
||||
* Delete all <b>all keys</b> from <b>all databases</b>.
|
||||
* <p>
|
||||
* See http://redis.io/commands/flushall
|
||||
*
|
||||
* @see <a href="http://redis.io/commands/flushall">Redis Documentation: FLUSHALL</a>
|
||||
*/
|
||||
void flushAll();
|
||||
|
||||
/**
|
||||
* Load {@literal default} server information like
|
||||
* <ul>
|
||||
* <li>mempory</li>
|
||||
* <li>memory</li>
|
||||
* <li>cpu utilization</li>
|
||||
* <li>replication</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* See http://redis.io/commands/info
|
||||
*
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/info">Redis Documentation: INFO</a>
|
||||
*/
|
||||
Properties info();
|
||||
|
||||
/**
|
||||
* Load server information for given {@code selection}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/info
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/info">Redis Documentation: INFO</a>
|
||||
*/
|
||||
Properties info(String section);
|
||||
|
||||
/**
|
||||
* Shutdown server.
|
||||
* <p>
|
||||
* See http://redis.io/commands/shutdown
|
||||
*
|
||||
* @see <a href="http://redis.io/commands/shutdown">Redis Documentation: SHUTDOWN</a>
|
||||
*/
|
||||
void shutdown();
|
||||
|
||||
/**
|
||||
* Shutdown server.
|
||||
* <p>
|
||||
* See http://redis.io/commands/shutdown
|
||||
*
|
||||
*
|
||||
* @see <a href="http://redis.io/commands/shutdown">Redis Documentation: SHUTDOWN</a>
|
||||
* @since 1.3
|
||||
*/
|
||||
void shutdown(ShutdownOption option);
|
||||
|
||||
/**
|
||||
* Load configuration parameters for given {@code pattern} from server.
|
||||
* <p>
|
||||
* See http://redis.io/commands/config-get
|
||||
*
|
||||
*
|
||||
* @param pattern
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/config-get">Redis Documentation: CONFIG GET</a>
|
||||
*/
|
||||
List<String> getConfig(String pattern);
|
||||
|
||||
/**
|
||||
* Set server configuration for {@code param} to {@code value}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/config-set
|
||||
*
|
||||
*
|
||||
* @param param
|
||||
* @param value
|
||||
* @see <a href="http://redis.io/commands/config-set">Redis Documentation: CONFIG SET</a>
|
||||
*/
|
||||
void setConfig(String param, String value);
|
||||
|
||||
/**
|
||||
* Reset statistic counters on server. <br>
|
||||
* Counters can be retrieved using {@link #info()}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/config-resetstat
|
||||
*
|
||||
* @see <a href="http://redis.io/commands/config-resetstat">Redis Documentation: CONFIG RESETSTAT</a>
|
||||
*/
|
||||
void resetConfigStats();
|
||||
|
||||
@@ -177,6 +170,7 @@ public interface RedisServerCommands {
|
||||
*
|
||||
* @return current server time in milliseconds.
|
||||
* @since 1.1
|
||||
* @see <a href="http://redis.io/commands/time">Redis Documentation: TIME</a>
|
||||
*/
|
||||
Long time();
|
||||
|
||||
@@ -186,6 +180,7 @@ public interface RedisServerCommands {
|
||||
* @param host of connection to close.
|
||||
* @param port of connection to close
|
||||
* @since 1.3
|
||||
* @see <a href="http://redis.io/commands/client-kill">Redis Documentation: CLIENT KILL</a>
|
||||
*/
|
||||
void killClient(String host, int port);
|
||||
|
||||
@@ -194,14 +189,14 @@ public interface RedisServerCommands {
|
||||
*
|
||||
* @param name
|
||||
* @since 1.3
|
||||
* @see <a href="http://redis.io/commands/client-setname">Redis Documentation: CLIENT SETNAME</a>
|
||||
*/
|
||||
void setClientName(byte[] name);
|
||||
|
||||
/**
|
||||
* Returns the name of the current connection.
|
||||
* <p>
|
||||
* See http://redis.io/commands/client-getname
|
||||
*
|
||||
*
|
||||
* @see <a href="http://redis.io/commands/client-getname">Redis Documentation: CLIENT GETNAME</a>
|
||||
* @return
|
||||
* @since 1.3
|
||||
*/
|
||||
@@ -209,50 +204,55 @@ public interface RedisServerCommands {
|
||||
|
||||
/**
|
||||
* Request information and statistics about connected clients.
|
||||
* <p>
|
||||
* See http://redis.io/commands/client-list
|
||||
*
|
||||
*
|
||||
* @return {@link List} of {@link RedisClientInfo} objects.
|
||||
* @since 1.3
|
||||
* @see <a href="http://redis.io/commands/client-list">Redis Documentation: CLIENT LIST</a>
|
||||
*/
|
||||
List<RedisClientInfo> getClientList();
|
||||
|
||||
/**
|
||||
* Change redis replication setting to new master.
|
||||
* <p>
|
||||
* See http://redis.io/commands/slaveof
|
||||
*
|
||||
* @param host
|
||||
*
|
||||
* @param host must not be {@literal null}.
|
||||
* @param port
|
||||
* @since 1.3
|
||||
* @see <a href="http://redis.io/commands/slaveof">Redis Documentation: SLAVEOF</a>
|
||||
*/
|
||||
void slaveOf(String host, int port);
|
||||
|
||||
/**
|
||||
* Change server into master.
|
||||
* <p>
|
||||
* See http://redis.io/commands/slaveof
|
||||
*
|
||||
*
|
||||
* @since 1.3
|
||||
* @see <a href="http://redis.io/commands/slaveof">Redis Documentation: SLAVEOF</a>
|
||||
*/
|
||||
void slaveOfNoOne();
|
||||
|
||||
/**
|
||||
* Atomically transfer a key from a source Redis instance to a destination Redis instance. On success the key is
|
||||
* deleted from the original instance and is guaranteed to exist in the target instance.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param target must not be {@literal null}.
|
||||
* @param dbIndex
|
||||
* @param option can be {@literal null}. Defaulted to {@link MigrateOption#COPY}.
|
||||
* @since 1.7
|
||||
* @see <a href="http://redis.io/commands/migrate">Redis Documentation: MIGRATE</a>
|
||||
*/
|
||||
void migrate(byte[] key, RedisNode target, int dbIndex, MigrateOption option);
|
||||
|
||||
/**
|
||||
* Atomically transfer a key from a source Redis instance to a destination Redis instance. On success the key is
|
||||
* deleted from the original instance and is guaranteed to exist in the target instance.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param target must not be {@literal null}.
|
||||
* @param dbIndex
|
||||
* @param option can be {@literal null}. Defaulted to {@link MigrateOption#COPY}.
|
||||
* @param timeout
|
||||
* @since 1.7
|
||||
* @see <a href="http://redis.io/commands/migrate">Redis Documentation: MIGRATE</a>
|
||||
*/
|
||||
void migrate(byte[] key, RedisNode target, int dbIndex, MigrateOption option, long timeout);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2014 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,177 +26,162 @@ import org.springframework.data.redis.core.ScanOptions;
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface RedisSetCommands {
|
||||
|
||||
/**
|
||||
* Add given {@code values} to set at {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/sadd
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param values
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sadd">Redis Documentation: SADD</a>
|
||||
*/
|
||||
Long sAdd(byte[] key, byte[]... values);
|
||||
|
||||
/**
|
||||
* Remove given {@code values} from set at {@code key} and return the number of removed elements.
|
||||
* <p>
|
||||
* See http://redis.io/commands/srem
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param values
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/srem">Redis Documentation: SREM</a>
|
||||
*/
|
||||
Long sRem(byte[] key, byte[]... values);
|
||||
|
||||
/**
|
||||
* Remove and return a random member from set at {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/spop
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/spop">Redis Documentation: SPOP</a>
|
||||
*/
|
||||
byte[] sPop(byte[] key);
|
||||
|
||||
/**
|
||||
* Move {@code value} from {@code srcKey} to {@code destKey}
|
||||
* <p>
|
||||
* See http://redis.io/commands/smove
|
||||
*
|
||||
* @param srcKey
|
||||
* @param destKey
|
||||
*
|
||||
* @param srcKey must not be {@literal null}.
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/smove">Redis Documentation: SMOVE</a>
|
||||
*/
|
||||
Boolean sMove(byte[] srcKey, byte[] destKey, byte[] value);
|
||||
|
||||
/**
|
||||
* Get size of set at {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/scard
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/scard">Redis Documentation: SCARD</a>
|
||||
*/
|
||||
Long sCard(byte[] key);
|
||||
|
||||
/**
|
||||
* Check if set at {@code key} contains {@code value}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/sismember
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sismember">Redis Documentation: SISMEMBER</a>
|
||||
*/
|
||||
Boolean sIsMember(byte[] key, byte[] value);
|
||||
|
||||
/**
|
||||
* Returns the members intersecting all given sets at {@code keys}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/sinter
|
||||
*
|
||||
* @param keys
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sinter">Redis Documentation: SINTER</a>
|
||||
*/
|
||||
Set<byte[]> sInter(byte[]... keys);
|
||||
|
||||
/**
|
||||
* Intersect all given sets at {@code keys} and store result in {@code destKey}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/sinterstore
|
||||
*
|
||||
* @param destKey
|
||||
* @param keys
|
||||
*
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sinterstore">Redis Documentation: SINTERSTORE</a>
|
||||
*/
|
||||
Long sInterStore(byte[] destKey, byte[]... keys);
|
||||
|
||||
/**
|
||||
* Union all sets at given {@code keys}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/sunion
|
||||
*
|
||||
* @param keys
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sunion">Redis Documentation: SUNION</a>
|
||||
*/
|
||||
Set<byte[]> sUnion(byte[]... keys);
|
||||
|
||||
/**
|
||||
* Union all sets at given {@code keys} and store result in {@code destKey}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/sunionstore
|
||||
*
|
||||
* @param destKey
|
||||
* @param keys
|
||||
*
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sunionstore">Redis Documentation: SUNIONSTORE</a>
|
||||
*/
|
||||
Long sUnionStore(byte[] destKey, byte[]... keys);
|
||||
|
||||
/**
|
||||
* Diff all sets for given {@code keys}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/sdiff
|
||||
*
|
||||
* @param keys
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sdiff">Redis Documentation: SDIFF</a>
|
||||
*/
|
||||
Set<byte[]> sDiff(byte[]... keys);
|
||||
|
||||
/**
|
||||
* Diff all sets for given {@code keys} and store result in {@code destKey}
|
||||
* <p>
|
||||
* See http://redis.io/commands/sdiffstore
|
||||
*
|
||||
* @param destKey
|
||||
* @param keys
|
||||
* Diff all sets for given {@code keys} and store result in {@code destKey}.
|
||||
*
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sdiffstore">Redis Documentation: SDIFFSTORE</a>
|
||||
*/
|
||||
Long sDiffStore(byte[] destKey, byte[]... keys);
|
||||
|
||||
/**
|
||||
* Get all elements of set at {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/smembers
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/smembers">Redis Documentation: SMEMBERS</a>
|
||||
*/
|
||||
Set<byte[]> sMembers(byte[] key);
|
||||
|
||||
/**
|
||||
* Get random element from set at {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/srandmember
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/srandmember">Redis Documentation: SRANDMEMBER</a>
|
||||
*/
|
||||
byte[] sRandMember(byte[] key);
|
||||
|
||||
/**
|
||||
* Get {@code count} random elements from set at {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/srandmember
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param count
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/srandmember">Redis Documentation: SRANDMEMBER</a>
|
||||
*/
|
||||
List<byte[]> sRandMember(byte[] key, long count);
|
||||
|
||||
/**
|
||||
* Use a {@link Cursor} to iterate over elements in set at {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/scan
|
||||
*
|
||||
* @since 1.4
|
||||
* @param key
|
||||
* @param options
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param options must not be {@literal null}.
|
||||
* @return
|
||||
* @since 1.4
|
||||
* @see <a href="http://redis.io/commands/scan">Redis Documentation: SCAN</a>
|
||||
*/
|
||||
Cursor<byte[]> sScan(byte[] key, ScanOptions options);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2016 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -35,264 +35,240 @@ public interface RedisStringCommands {
|
||||
|
||||
/**
|
||||
* Get the value of {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/get
|
||||
*
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/get">Redis Documentation: GET</a>
|
||||
*/
|
||||
byte[] get(byte[] key);
|
||||
|
||||
/**
|
||||
* Set value of {@code key} and return its old value.
|
||||
* <p>
|
||||
* See http://redis.io/commands/getset
|
||||
*
|
||||
* Set {@code value} of {@code key} and return its old value.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/getset">Redis Documentation: GETSET</a>
|
||||
*/
|
||||
byte[] getSet(byte[] key, byte[] value);
|
||||
|
||||
/**
|
||||
* Get the values of all given {@code keys}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/mget
|
||||
*
|
||||
* @param keys
|
||||
* Get multiple {@code keys}. Values are returned in the order of the requested keys.
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/mget">Redis Documentation: MGET</a>
|
||||
*/
|
||||
List<byte[]> mGet(byte[]... keys);
|
||||
|
||||
/**
|
||||
* Set {@code value} for {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/set
|
||||
*
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/set">Redis Documentation: SET</a>
|
||||
*/
|
||||
void set(byte[] key, byte[] value);
|
||||
|
||||
/**
|
||||
* Set {@code value} for {@code key} applying timeouts from {@code expiration} if set and inserting/updating values
|
||||
* depending on {@code option}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/set
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @param expiration can be {@literal null}. Defaulted to {@link Expiration#persistent()}.
|
||||
* @param option can be {@literal null}. Defaulted to {@link SetOption#UPSERT}.
|
||||
* @since 1.7
|
||||
* @see <a href="http://redis.io/commands/set">Redis Documentation: SET</a>
|
||||
*/
|
||||
void set(byte[] key, byte[] value, Expiration expiration, SetOption option);
|
||||
|
||||
/**
|
||||
* Set {@code value} for {@code key}, only if {@code key} does not exist.
|
||||
* <p>
|
||||
* See http://redis.io/commands/setnx
|
||||
*
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/setnx">Redis Documentation: SETNX</a>
|
||||
*/
|
||||
Boolean setNX(byte[] key, byte[] value);
|
||||
|
||||
/**
|
||||
* Set the {@code value} and expiration in {@code seconds} for {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/setex
|
||||
*
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param seconds
|
||||
* @param value must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/setex">Redis Documentation: SETEX</a>
|
||||
*/
|
||||
void setEx(byte[] key, long seconds, byte[] value);
|
||||
|
||||
/**
|
||||
* Set the {@code value} and expiration in {@code milliseconds} for {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/psetex
|
||||
*
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param milliseconds
|
||||
* @param value must not be {@literal null}.
|
||||
* @since 1.3
|
||||
* @see <a href="http://redis.io/commands/psetex">Redis Documentation: PSETEX</a>
|
||||
*/
|
||||
void pSetEx(byte[] key, long milliseconds, byte[] value);
|
||||
|
||||
/**
|
||||
* Set multiple keys to multiple values using key-value pairs provided in {@code tuple}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/mset
|
||||
*
|
||||
* @param tuple
|
||||
*
|
||||
* @param tuple must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/mset">Redis Documentation: MSET</a>
|
||||
*/
|
||||
void mSet(Map<byte[], byte[]> tuple);
|
||||
|
||||
/**
|
||||
* Set multiple keys to multiple values using key-value pairs provided in {@code tuple} only if the provided key does
|
||||
* not exist.
|
||||
* <p>
|
||||
* See http://redis.io/commands/msetnx
|
||||
*
|
||||
* @param tuple
|
||||
*
|
||||
* @param tuple must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/msetnx">Redis Documentation: MSETNX</a>
|
||||
*/
|
||||
Boolean mSetNX(Map<byte[], byte[]> tuple);
|
||||
|
||||
/**
|
||||
* Increment value of {@code key} by 1.
|
||||
* <p>
|
||||
* See http://redis.io/commands/incr
|
||||
*
|
||||
* Increment an integer value stored as string value of {@code key} by 1.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/incr">Redis Documentation: INCR</a>
|
||||
*/
|
||||
Long incr(byte[] key);
|
||||
|
||||
/**
|
||||
* Increment value of {@code key} by {@code value}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/incrby
|
||||
*
|
||||
* Increment an integer value stored of {@code key} by {@code delta}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/incrby">Redis Documentation: INCRBY</a>
|
||||
*/
|
||||
Long incrBy(byte[] key, long value);
|
||||
|
||||
/**
|
||||
* Increment value of {@code key} by {@code value}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/incrbyfloat
|
||||
*
|
||||
* Increment a floating point number value of {@code key} by {@code delta}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/incrbyfloat">Redis Documentation: INCRBYFLOAT</a>
|
||||
*/
|
||||
Double incrBy(byte[] key, double value);
|
||||
|
||||
/**
|
||||
* Decrement value of {@code key} by 1.
|
||||
* <p>
|
||||
* See http://redis.io/commands/decr
|
||||
*
|
||||
* Decrement an integer value stored as string value of {@code key} by 1.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/decr">Redis Documentation: DECR</a>
|
||||
*/
|
||||
Long decr(byte[] key);
|
||||
|
||||
/**
|
||||
* Increment value of {@code key} by {@code value}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/decrby
|
||||
*
|
||||
* Decrement an integer value stored as string value of {@code key} by {@code value}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/decrby">Redis Documentation: DECRBY</a>
|
||||
*/
|
||||
Long decrBy(byte[] key, long value);
|
||||
|
||||
/**
|
||||
* Append a {@code value} to {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/append
|
||||
*
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/append">Redis Documentation: APPEND</a>
|
||||
*/
|
||||
Long append(byte[] key, byte[] value);
|
||||
|
||||
/**
|
||||
* Get a substring of value of {@code key} between {@code begin} and {@code end}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/getrange
|
||||
*
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param begin
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/getrange">Redis Documentation: GETRANGE</a>
|
||||
*/
|
||||
byte[] getRange(byte[] key, long begin, long end);
|
||||
|
||||
/**
|
||||
* Overwrite parts of {@code key} starting at the specified {@code offset} with given {@code value}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/setrange
|
||||
*
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value
|
||||
* @param offset
|
||||
* @see <a href="http://redis.io/commands/setrange">Redis Documentation: SETRANGE</a>
|
||||
*/
|
||||
void setRange(byte[] key, byte[] value, long offset);
|
||||
|
||||
/**
|
||||
* Get the bit value at {@code offset} of value at {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/getbit
|
||||
*
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param offset
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/getbit">Redis Documentation: GETBIT</a>
|
||||
*/
|
||||
Boolean getBit(byte[] key, long offset);
|
||||
|
||||
/**
|
||||
* Sets the bit at {@code offset} in value stored at {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/setbit
|
||||
*
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param offset
|
||||
* @param value
|
||||
* @return the original bit value stored at {@code offset}.
|
||||
* @see <a href="http://redis.io/commands/setbit">Redis Documentation: SETBIT</a>
|
||||
*/
|
||||
Boolean setBit(byte[] key, long offset, boolean value);
|
||||
|
||||
/**
|
||||
* Count the number of set bits (population counting) in value stored at {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/bitcount
|
||||
*
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/bitcount">Redis Documentation: BITCOUNT</a>
|
||||
*/
|
||||
Long bitCount(byte[] key);
|
||||
|
||||
/**
|
||||
* Count the number of set bits (population counting) of value stored at {@code key} between {@code begin} and
|
||||
* {@code end}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/bitcount
|
||||
*
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param begin
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/bitcount">Redis Documentation: BITCOUNT</a>
|
||||
*/
|
||||
Long bitCount(byte[] key, long begin, long end);
|
||||
|
||||
/**
|
||||
* Perform bitwise operations between strings.
|
||||
* <p>
|
||||
* See http://redis.io/commands/bitop
|
||||
*
|
||||
* @param op
|
||||
* @param destination
|
||||
* @param keys
|
||||
*
|
||||
* @param op must not be {@literal null}.
|
||||
* @param destination must not be {@literal null}.
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/bitop">Redis Documentation: BITOP</a>
|
||||
*/
|
||||
Long bitOp(BitOperation op, byte[] destination, byte[]... keys);
|
||||
|
||||
/**
|
||||
* Get the length of the value stored at {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/strlen
|
||||
*
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/strlen">Redis Documentation: STRLEN</a>
|
||||
*/
|
||||
Long strLen(byte[] key);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2014 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,6 +22,7 @@ import java.util.List;
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface RedisTxCommands {
|
||||
|
||||
@@ -29,40 +30,39 @@ public interface RedisTxCommands {
|
||||
* Mark the start of a transaction block. <br>
|
||||
* Commands will be queued and can then be executed by calling {@link #exec()} or rolled back using {@link #discard()}
|
||||
* <p>
|
||||
* See http://redis.io/commands/multi
|
||||
*
|
||||
* @see <a href="http://redis.io/commands/multi">Redis Documentation: MULTI</a>
|
||||
*/
|
||||
void multi();
|
||||
|
||||
/**
|
||||
* Executes all queued commands in a transaction started with {@link #multi()}. <br>
|
||||
* If used along with {@link #watch(byte[])} the operation will fail if any of watched keys has been modified.
|
||||
* <p>
|
||||
* See http://redis.io/commands/exec
|
||||
*
|
||||
* If used along with {@link #watch(byte[]...)} the operation will fail if any of watched keys has been modified.
|
||||
*
|
||||
* @return List of replies for each executed command.
|
||||
* @see <a href="http://redis.io/commands/exec">Redis Documentation: EXEC</a>
|
||||
*/
|
||||
List<Object> exec();
|
||||
|
||||
/**
|
||||
* Discard all commands issued after {@link #multi()}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/discard
|
||||
*
|
||||
* @see <a href="http://redis.io/commands/discard">Redis Documentation: DISCARD</a>
|
||||
*/
|
||||
void discard();
|
||||
|
||||
/**
|
||||
* Watch given {@code keys} for modifications during transaction started with {@link #multi()}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/watch
|
||||
*
|
||||
* @param keys
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/watch">Redis Documentation: WATCH</a>
|
||||
*/
|
||||
void watch(byte[]... keys);
|
||||
|
||||
/**
|
||||
* Flushes all the previously {@link #watch(byte[])} keys.
|
||||
* <p>
|
||||
* See http://redis.io/commands/unwatch
|
||||
* Flushes all the previously {@link #watch(byte[]...)} keys.
|
||||
*
|
||||
* @see <a href="http://redis.io/commands/unwatch">Redis Documentation: UNWATCH</a>
|
||||
*/
|
||||
void unwatch();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2015 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,6 +28,7 @@ import org.springframework.util.Assert;
|
||||
* @author Christoph Strobl
|
||||
* @author Thomas Darimont
|
||||
* @author David Liu
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface RedisZSetCommands {
|
||||
|
||||
@@ -202,162 +203,150 @@ public interface RedisZSetCommands {
|
||||
public int getOffset() {
|
||||
return offset;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add {@code value} to a sorted set at {@code key}, or update its {@code score} if it already exists.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zadd
|
||||
*
|
||||
* @param key
|
||||
* @param score
|
||||
* @param value
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param score the score.
|
||||
* @param value the value.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zadd">Redis Documentation: ZADD</a>
|
||||
*/
|
||||
Boolean zAdd(byte[] key, double score, byte[] value);
|
||||
|
||||
/**
|
||||
* Add {@code tuples} to a sorted set at {@code key}, or update its {@code score} if it already exists.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zadd
|
||||
*
|
||||
* @param key
|
||||
* @param tuples
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param tuples must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zadd">Redis Documentation: ZADD</a>
|
||||
*/
|
||||
Long zAdd(byte[] key, Set<Tuple> tuples);
|
||||
|
||||
/**
|
||||
* Remove {@code values} from sorted set. Return number of removed elements.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zrem
|
||||
*
|
||||
* @param key
|
||||
* @param values
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param values must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrem">Redis Documentation: ZREM</a>
|
||||
*/
|
||||
Long zRem(byte[] key, byte[]... values);
|
||||
|
||||
/**
|
||||
* Increment the score of element with {@code value} in sorted set by {@code increment}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zincrby
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param increment
|
||||
* @param value
|
||||
* @param value the value.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zincrby">Redis Documentation: ZINCRBY</a>
|
||||
*/
|
||||
Double zIncrBy(byte[] key, double increment, byte[] value);
|
||||
|
||||
/**
|
||||
* Determine the index of element with {@code value} in a sorted set.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zrank
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value the value.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrank">Redis Documentation: ZRANK</a>
|
||||
*/
|
||||
Long zRank(byte[] key, byte[] value);
|
||||
|
||||
/**
|
||||
* Determine the index of element with {@code value} in a sorted set when scored high to low.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zrevrank
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value the value.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrank">Redis Documentation: ZREVRANK</a>
|
||||
*/
|
||||
Long zRevRank(byte[] key, byte[] value);
|
||||
|
||||
/**
|
||||
* Get elements between {@code begin} and {@code end} from sorted set.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zrange
|
||||
*
|
||||
* @param key
|
||||
* @param begin
|
||||
* Get elements between {@code start} and {@code end} from sorted set.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrange">Redis Documentation: ZRANGE</a>
|
||||
*/
|
||||
Set<byte[]> zRange(byte[] key, long begin, long end);
|
||||
Set<byte[]> zRange(byte[] key, long start, long end);
|
||||
|
||||
/**
|
||||
* Get set of {@link Tuple}s between {@code begin} and {@code end} from sorted set.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zrange
|
||||
*
|
||||
* @param key
|
||||
* @param begin
|
||||
* Get set of {@link Tuple}s between {@code start} and {@code end} from sorted set.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrange">Redis Documentation: ZRANGE</a>
|
||||
*/
|
||||
Set<Tuple> zRangeWithScores(byte[] key, long begin, long end);
|
||||
Set<Tuple> zRangeWithScores(byte[] key, long start, long end);
|
||||
|
||||
/**
|
||||
* Get elements where score is between {@code min} and {@code max} from sorted set.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zrangebyscore
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param min
|
||||
* @param max
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<byte[]> zRangeByScore(byte[] key, double min, double max);
|
||||
|
||||
/**
|
||||
* Get set of {@link Tuple}s where score is between {@code Range#min} and {@code Range#max} from sorted set.
|
||||
*
|
||||
* @param key
|
||||
* @param range
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @return
|
||||
* @since 1.6
|
||||
* @see <a href="http://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<Tuple> zRangeByScoreWithScores(byte[] key, Range range);
|
||||
|
||||
/**
|
||||
* Get set of {@link Tuple}s where score is between {@code min} and {@code max} from sorted set.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zrangebyscore
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param min
|
||||
* @param max
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<Tuple> zRangeByScoreWithScores(byte[] key, double min, double max);
|
||||
|
||||
/**
|
||||
* Get elements in range from {@code begin} to {@code end} where score is between {@code min} and {@code max} from
|
||||
* Get elements in range from {@code start} to {@code end} where score is between {@code min} and {@code max} from
|
||||
* sorted set.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zrangebyscore
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param min
|
||||
* @param max
|
||||
* @param offset
|
||||
* @param count
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<byte[]> zRangeByScore(byte[] key, double min, double max, long offset, long count);
|
||||
|
||||
/**
|
||||
* Get set of {@link Tuple}s in range from {@code begin} to {@code end} where score is between {@code min} and
|
||||
* Get set of {@link Tuple}s in range from {@code start} to {@code end} where score is between {@code min} and
|
||||
* {@code max} from sorted set.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zrangebyscore
|
||||
*
|
||||
*
|
||||
* @param key
|
||||
* @param min
|
||||
* @param max
|
||||
* @param offset
|
||||
* @param count
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<Tuple> zRangeByScoreWithScores(byte[] key, double min, double max, long offset, long count);
|
||||
|
||||
@@ -365,47 +354,45 @@ public interface RedisZSetCommands {
|
||||
* Get set of {@link Tuple}s in range from {@code Limit#offset} to {@code Limit#offset + Limit#count} where score is
|
||||
* between {@code Range#min} and {@code Range#max} from sorted set.
|
||||
*
|
||||
* @param key
|
||||
* @param range
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @param limit
|
||||
* @return
|
||||
* @since 1.6
|
||||
* @see <a href="http://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<Tuple> zRangeByScoreWithScores(byte[] key, Range range, Limit limit);
|
||||
|
||||
/**
|
||||
* Get elements in range from {@code begin} to {@code end} from sorted set ordered from high to low.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zrevrange
|
||||
*
|
||||
* @param key
|
||||
* @param begin
|
||||
* Get elements in range from {@code start} to {@code end} from sorted set ordered from high to low.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrange">Redis Documentation: ZREVRANGE</a>
|
||||
*/
|
||||
Set<byte[]> zRevRange(byte[] key, long begin, long end);
|
||||
Set<byte[]> zRevRange(byte[] key, long start, long end);
|
||||
|
||||
/**
|
||||
* Get set of {@link Tuple}s in range from {@code begin} to {@code end} from sorted set ordered from high to low.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zrevrange
|
||||
*
|
||||
* @param key
|
||||
* @param begin
|
||||
* Get set of {@link Tuple}s in range from {@code start} to {@code end} from sorted set ordered from high to low.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrange">Redis Documentation: ZREVRANGE</a>
|
||||
*/
|
||||
Set<Tuple> zRevRangeWithScores(byte[] key, long begin, long end);
|
||||
Set<Tuple> zRevRangeWithScores(byte[] key, long start, long end);
|
||||
|
||||
/**
|
||||
* Get elements where score is between {@code min} and {@code max} from sorted set ordered from high to low.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zrevrange
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param min
|
||||
* @param max
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrange">Redis Documentation: ZREVRANGE</a>
|
||||
*/
|
||||
Set<byte[]> zRevRangeByScore(byte[] key, double min, double max);
|
||||
|
||||
@@ -413,306 +400,303 @@ public interface RedisZSetCommands {
|
||||
* Get elements where score is between {@code Range#min} and {@code Range#max} from sorted set ordered from high to
|
||||
* low.
|
||||
*
|
||||
* @param key
|
||||
* @param range
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @return
|
||||
* @since 1.6
|
||||
* @see <a href="http://redis.io/commands/zrevrangebyscore">Redis Documentation: ZREVRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<byte[]> zRevRangeByScore(byte[] key, Range range);
|
||||
|
||||
/**
|
||||
* Get set of {@link Tuple} where score is between {@code min} and {@code max} from sorted set ordered from high to
|
||||
* low.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zrevrange
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param min
|
||||
* @param max
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrangebyscore">Redis Documentation: ZREVRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<Tuple> zRevRangeByScoreWithScores(byte[] key, double min, double max);
|
||||
|
||||
/**
|
||||
* Get elements in range from {@code begin} to {@code end} where score is between {@code min} and {@code max} from
|
||||
* Get elements in range from {@code start} to {@code end} where score is between {@code min} and {@code max} from
|
||||
* sorted set ordered high -> low.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zrevrangebyscore
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param min
|
||||
* @param max
|
||||
* @param offset
|
||||
* @param count
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrangebyscore">Redis Documentation: ZREVRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<byte[]> zRevRangeByScore(byte[] key, double min, double max, long offset, long count);
|
||||
|
||||
/**
|
||||
* Get elements in range from {@code Limit#offset} to {@code Limit#offset + Limit#count} where score is between
|
||||
* {@code Range#min} and {@code Range#max} from sorted set ordered high -> low.
|
||||
*
|
||||
* @param key
|
||||
* @param range
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @param limit
|
||||
* @return
|
||||
* @since 1.6
|
||||
* @see <a href="http://redis.io/commands/zrevrangebyscore">Redis Documentation: ZREVRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<byte[]> zRevRangeByScore(byte[] key, Range range, Limit limit);
|
||||
|
||||
/**
|
||||
* Get set of {@link Tuple} in range from {@code begin} to {@code end} where score is between {@code min} and
|
||||
* Get set of {@link Tuple} in range from {@code start} to {@code end} where score is between {@code min} and
|
||||
* {@code max} from sorted set ordered high -> low.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zrevrangebyscore
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param min
|
||||
* @param max
|
||||
* @param offset
|
||||
* @param count
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrangebyscore">Redis Documentation: ZREVRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<Tuple> zRevRangeByScoreWithScores(byte[] key, double min, double max, long offset, long count);
|
||||
|
||||
/**
|
||||
* Get set of {@link Tuple} where score is between {@code Range#min} and {@code Range#max} from sorted set ordered
|
||||
* from high to low.
|
||||
*
|
||||
* @param key
|
||||
* @param range
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @return
|
||||
* @since 1.6
|
||||
* @see <a href="http://redis.io/commands/zrevrangebyscore">Redis Documentation: ZREVRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<Tuple> zRevRangeByScoreWithScores(byte[] key, Range range);
|
||||
|
||||
/**
|
||||
* Get set of {@link Tuple} in range from {@code Limit#offset} to {@code Limit#count} where score is between
|
||||
* {@code Range#min} and {@code Range#max} from sorted set ordered high -> low.
|
||||
*
|
||||
* @param key
|
||||
* @param range
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @param limit
|
||||
* @return
|
||||
* @since 1.6
|
||||
* @see <a href="http://redis.io/commands/zrevrangebyscore">Redis Documentation: ZREVRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<Tuple> zRevRangeByScoreWithScores(byte[] key, Range range, Limit limit);
|
||||
|
||||
/**
|
||||
* Count number of elements within sorted set with scores between {@code min} and {@code max}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zcount
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param min
|
||||
* @param max
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zcount">Redis Documentation: ZCOUNT</a>
|
||||
*/
|
||||
Long zCount(byte[] key, double min, double max);
|
||||
|
||||
/**
|
||||
* Count number of elements within sorted set with scores between {@code Range#min} and {@code Range#max}.
|
||||
*
|
||||
* @param key
|
||||
* @param min
|
||||
* @param max
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @return
|
||||
* @since 1.6
|
||||
* @see <a href="http://redis.io/commands/zcount">Redis Documentation: ZCOUNT</a>
|
||||
*/
|
||||
Long zCount(byte[] key, Range range);
|
||||
|
||||
/**
|
||||
* Get the size of sorted set with {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zcard
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zcard">Redis Documentation: ZCARD</a>
|
||||
*/
|
||||
Long zCard(byte[] key);
|
||||
|
||||
/**
|
||||
* Get the score of element with {@code value} from sorted set with key {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zrem
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value the value.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrem">Redis Documentation: ZREM</a>
|
||||
*/
|
||||
Double zScore(byte[] key, byte[] value);
|
||||
|
||||
/**
|
||||
* Remove elements in range between {@code begin} and {@code end} from sorted set with {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zremrange
|
||||
* Remove elements in range between {@code start} and {@code end} from sorted set with {@code key}.
|
||||
*
|
||||
* @param key
|
||||
* @param begin
|
||||
* @param key must not be {@literal null}.
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zremrangebyrank">Redis Documentation: ZREMRANGEBYRANK</a>
|
||||
*/
|
||||
Long zRemRange(byte[] key, long begin, long end);
|
||||
Long zRemRange(byte[] key, long start, long end);
|
||||
|
||||
/**
|
||||
* Remove elements with scores between {@code min} and {@code max} from sorted set with {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zremrangebyscore
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param min
|
||||
* @param max
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zremrangebyscore">Redis Documentation: ZREMRANGEBYSCORE</a>
|
||||
*/
|
||||
Long zRemRangeByScore(byte[] key, double min, double max);
|
||||
|
||||
/**
|
||||
* Remove elements with scores between {@code Range#min} and {@code Range#max} from sorted set with {@code key}.
|
||||
*
|
||||
* @param key
|
||||
* @param range
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @return
|
||||
* @since 1.6
|
||||
* @see <a href="http://redis.io/commands/zremrangebyscore">Redis Documentation: ZREMRANGEBYSCORE</a>
|
||||
*/
|
||||
Long zRemRangeByScore(byte[] key, Range range);
|
||||
|
||||
/**
|
||||
* Union sorted {@code sets} and store result in destination {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zunionstore
|
||||
*
|
||||
* @param destKey
|
||||
* @param sets
|
||||
*
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @param sets must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zunionstore">Redis Documentation: ZUNIONSTORE</a>
|
||||
*/
|
||||
Long zUnionStore(byte[] destKey, byte[]... sets);
|
||||
|
||||
/**
|
||||
* Union sorted {@code sets} and store result in destination {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zunionstore
|
||||
*
|
||||
* @param destKey
|
||||
* @param aggregate
|
||||
*
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @param aggregate must not be {@literal null}.
|
||||
* @param weights
|
||||
* @param sets
|
||||
* @param sets must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zunionstore">Redis Documentation: ZUNIONSTORE</a>
|
||||
*/
|
||||
Long zUnionStore(byte[] destKey, Aggregate aggregate, int[] weights, byte[]... sets);
|
||||
|
||||
/**
|
||||
* Intersect sorted {@code sets} and store result in destination {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zinterstore
|
||||
*
|
||||
* @param destKey
|
||||
* @param sets
|
||||
*
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @param sets must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zinterstore">Redis Documentation: ZINTERSTORE</a>
|
||||
*/
|
||||
Long zInterStore(byte[] destKey, byte[]... sets);
|
||||
|
||||
/**
|
||||
* Intersect sorted {@code sets} and store result in destination {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zinterstore
|
||||
*
|
||||
* @param destKey
|
||||
* @param sets
|
||||
*
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @param aggregate must not be {@literal null}.
|
||||
* @param weights
|
||||
* @param sets must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zinterstore">Redis Documentation: ZINTERSTORE</a>
|
||||
*/
|
||||
Long zInterStore(byte[] destKey, Aggregate aggregate, int[] weights, byte[]... sets);
|
||||
|
||||
/**
|
||||
* Use a {@link Cursor} to iterate over elements in sorted set at {@code key}.
|
||||
* <p>
|
||||
* See http://redis.io/commands/scan
|
||||
*
|
||||
* @since 1.4
|
||||
* @param key
|
||||
* @param options
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param options must not be {@literal null}.
|
||||
* @return
|
||||
* @since 1.4
|
||||
* @see <a href="http://redis.io/commands/zscan">Redis Documentation: ZSCAN</a>
|
||||
*/
|
||||
Cursor<Tuple> zScan(byte[] key, ScanOptions options);
|
||||
|
||||
/**
|
||||
* Get elements where score is between {@code min} and {@code max} from sorted set.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zrangebyscore
|
||||
*
|
||||
* @since 1.5
|
||||
* @param key
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param min
|
||||
* @param max
|
||||
* @return
|
||||
* @since 1.5
|
||||
* @see <a href="http://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<byte[]> zRangeByScore(byte[] key, String min, String max);
|
||||
|
||||
/**
|
||||
* Get elements where score is between {@code Range#min} and {@code Range#max} from sorted set.
|
||||
*
|
||||
* @param key
|
||||
* @param range
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @return
|
||||
* @since 1.6
|
||||
* @see <a href="http://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<byte[]> zRangeByScore(byte[] key, Range range);
|
||||
|
||||
/**
|
||||
* Get elements in range from {@code begin} to {@code end} where score is between {@code min} and {@code max} from
|
||||
* Get elements in range from {@code start} to {@code end} where score is between {@code min} and {@code max} from
|
||||
* sorted set.
|
||||
* <p>
|
||||
* See http://redis.io/commands/zrangebyscore
|
||||
*
|
||||
* @since 1.5
|
||||
* @param key
|
||||
* @param min
|
||||
* @param max
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param min must not be {@literal null}.
|
||||
* @param max must not be {@literal null}.
|
||||
* @param offset
|
||||
* @param count
|
||||
* @return
|
||||
* @since 1.5
|
||||
* @see <a href="http://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<byte[]> zRangeByScore(byte[] key, String min, String max, long offset, long count);
|
||||
|
||||
/**
|
||||
* Get elements in range from {@code Limit#count} to {@code Limit#offset} where score is between {@code Range#min} and
|
||||
* {@code Range#max} from sorted set.
|
||||
*
|
||||
* @param key
|
||||
* @param range
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @param limit
|
||||
* @return
|
||||
* @since 1.6
|
||||
* @see <a href="http://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<byte[]> zRangeByScore(byte[] key, Range range, Limit limit);
|
||||
|
||||
/**
|
||||
* Get all the elements in the sorted set at {@literal key} in lexicographical ordering.
|
||||
*
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @since 1.6
|
||||
* @see <a href="http://redis.io/commands/zrangebylex">Redis Documentation: ZRANGEBYLEX</a>
|
||||
*/
|
||||
Set<byte[]> zRangeByLex(byte[] key);
|
||||
|
||||
/**
|
||||
* Get all the elements in {@link Range} from the sorted set at {@literal key} in lexicographical ordering.
|
||||
*
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @return
|
||||
* @since 1.6
|
||||
* @see <a href="http://redis.io/commands/zrangebylex">Redis Documentation: ZRANGEBYLEX</a>
|
||||
*/
|
||||
Set<byte[]> zRangeByLex(byte[] key, Range range);
|
||||
|
||||
/**
|
||||
* Get all the elements in {@link Range} from the sorted set at {@literal key} in lexicographical ordering. Result is
|
||||
* limited via {@link Limit}.
|
||||
*
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @param range can be {@literal null}.
|
||||
* @return
|
||||
* @since 1.6
|
||||
* @see <a href="http://redis.io/commands/zrangebylex">Redis Documentation: ZRANGEBYLEX</a>
|
||||
*/
|
||||
Set<byte[]> zRangeByLex(byte[] key, Range range, Limit limit);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,7 +41,7 @@ public interface BoundGeoOperations<K, M> extends BoundKeyOperations<K> {
|
||||
* @param point must not be {@literal null}.
|
||||
* @param member must not be {@literal null}.
|
||||
* @return Number of elements added.
|
||||
* @see <a href="http://redis.io/commands/geoadd">http://redis.io/commands/geoadd</a>
|
||||
* @see <a href="http://redis.io/commands/geoadd">Redis Documentation: GEOADD</a>
|
||||
*/
|
||||
Long geoAdd(Point point, M member);
|
||||
|
||||
@@ -50,7 +50,7 @@ public interface BoundGeoOperations<K, M> extends BoundKeyOperations<K> {
|
||||
*
|
||||
* @param location must not be {@literal null}.
|
||||
* @return Number of elements added.
|
||||
* @see <a href="http://redis.io/commands/geoadd">http://redis.io/commands/geoadd</a>
|
||||
* @see <a href="http://redis.io/commands/geoadd">Redis Documentation: GEOADD</a>
|
||||
*/
|
||||
Long geoAdd(GeoLocation<M> location);
|
||||
|
||||
@@ -59,7 +59,7 @@ public interface BoundGeoOperations<K, M> extends BoundKeyOperations<K> {
|
||||
*
|
||||
* @param memberCoordinateMap must not be {@literal null}.
|
||||
* @return Number of elements added.
|
||||
* @see <a href="http://redis.io/commands/geoadd">http://redis.io/commands/geoadd</a>
|
||||
* @see <a href="http://redis.io/commands/geoadd">Redis Documentation: GEOADD</a>
|
||||
*/
|
||||
Long geoAdd(Map<M, Point> memberCoordinateMap);
|
||||
|
||||
@@ -68,7 +68,7 @@ public interface BoundGeoOperations<K, M> extends BoundKeyOperations<K> {
|
||||
*
|
||||
* @param locations must not be {@literal null}.
|
||||
* @return Number of elements added.
|
||||
* @see <a href="http://redis.io/commands/geoadd">http://redis.io/commands/geoadd</a>
|
||||
* @see <a href="http://redis.io/commands/geoadd">Redis Documentation: GEOADD</a>
|
||||
*/
|
||||
Long geoAdd(Iterable<GeoLocation<M>> locations);
|
||||
|
||||
@@ -78,7 +78,7 @@ public interface BoundGeoOperations<K, M> extends BoundKeyOperations<K> {
|
||||
* @param member1 must not be {@literal null}.
|
||||
* @param member2 must not be {@literal null}.
|
||||
* @return can be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/geodist">http://redis.io/commands/geodist</a>
|
||||
* @see <a href="http://redis.io/commands/geodist">Redis Documentation: GEODIST</a>
|
||||
*/
|
||||
Distance geoDist(M member1, M member2);
|
||||
|
||||
@@ -89,7 +89,7 @@ public interface BoundGeoOperations<K, M> extends BoundKeyOperations<K> {
|
||||
* @param member2 must not be {@literal null}.
|
||||
* @param metric must not be {@literal null}.
|
||||
* @return can be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/geodist">http://redis.io/commands/geodist</a>
|
||||
* @see <a href="http://redis.io/commands/geodist">Redis Documentation: GEODIST</a>
|
||||
*/
|
||||
Distance geoDist(M member1, M member2, Metric metric);
|
||||
|
||||
@@ -98,7 +98,7 @@ public interface BoundGeoOperations<K, M> extends BoundKeyOperations<K> {
|
||||
*
|
||||
* @param members must not be {@literal null}.
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/geohash">http://redis.io/commands/geohash</a>
|
||||
* @see <a href="http://redis.io/commands/geohash">Redis Documentation: GEOHASH</a>
|
||||
*/
|
||||
List<String> geoHash(M... members);
|
||||
|
||||
@@ -107,7 +107,7 @@ public interface BoundGeoOperations<K, M> extends BoundKeyOperations<K> {
|
||||
*
|
||||
* @param members must not be {@literal null}.
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/geopos">http://redis.io/commands/geopos</a>
|
||||
* @see <a href="http://redis.io/commands/geopos">Redis Documentation: GEOPOS</a>
|
||||
*/
|
||||
List<Point> geoPos(M... members);
|
||||
|
||||
@@ -116,7 +116,7 @@ public interface BoundGeoOperations<K, M> extends BoundKeyOperations<K> {
|
||||
*
|
||||
* @param within must not be {@literal null}.
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/georadius">http://redis.io/commands/georadius</a>
|
||||
* @see <a href="http://redis.io/commands/georadius">Redis Documentation: GEORADIUS</a>
|
||||
*/
|
||||
GeoResults<GeoLocation<M>> geoRadius(Circle within);
|
||||
|
||||
@@ -126,7 +126,7 @@ public interface BoundGeoOperations<K, M> extends BoundKeyOperations<K> {
|
||||
* @param within must not be {@literal null}.
|
||||
* @param args must not be {@literal null}.
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/georadius">http://redis.io/commands/georadius</a>
|
||||
* @see <a href="http://redis.io/commands/georadius">Redis Documentation: GEORADIUS</a>
|
||||
*/
|
||||
GeoResults<GeoLocation<M>> geoRadius(Circle within, GeoRadiusCommandArgs args);
|
||||
|
||||
@@ -137,7 +137,7 @@ public interface BoundGeoOperations<K, M> extends BoundKeyOperations<K> {
|
||||
* @param member must not be {@literal null}.
|
||||
* @param radius
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/georadiusbymember">http://redis.io/commands/georadiusbymember</a>
|
||||
* @see <a href="http://redis.io/commands/georadiusbymember">Redis Documentation: GEORADIUSBYMEMBER</a>
|
||||
*/
|
||||
GeoResults<GeoLocation<M>> geoRadiusByMember(K key, M member, double radius);
|
||||
|
||||
@@ -148,7 +148,7 @@ public interface BoundGeoOperations<K, M> extends BoundKeyOperations<K> {
|
||||
* @param member must not be {@literal null}.
|
||||
* @param distance must not be {@literal null}.
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/georadiusbymember">http://redis.io/commands/georadiusbymember</a>
|
||||
* @see <a href="http://redis.io/commands/georadiusbymember">Redis Documentation: GEORADIUSBYMEMBER</a>
|
||||
*/
|
||||
GeoResults<GeoLocation<M>> geoRadiusByMember(M member, Distance distance);
|
||||
|
||||
@@ -160,7 +160,7 @@ public interface BoundGeoOperations<K, M> extends BoundKeyOperations<K> {
|
||||
* @param distance must not be {@literal null}.
|
||||
* @param args must not be {@literal null}.
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/georadiusbymember">http://redis.io/commands/georadiusbymember</a>
|
||||
* @see <a href="http://redis.io/commands/georadiusbymember">Redis Documentation: GEORADIUSBYMEMBER</a>
|
||||
*/
|
||||
GeoResults<GeoLocation<M>> geoRadiusByMember(M member, Distance distance, GeoRadiusCommandArgs args);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2016 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,16 +26,20 @@ import java.util.Set;
|
||||
* @author Costin Leau
|
||||
* @author Christoph Strobl
|
||||
* @author Ninad Divadkar
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface BoundHashOperations<H, HK, HV> extends BoundKeyOperations<H> {
|
||||
|
||||
/**
|
||||
* Delete given hash {@code keys} at the bound key.
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
*/
|
||||
RedisOperations<H, ?> getOperations();
|
||||
Long delete(Object... keys);
|
||||
|
||||
/**
|
||||
* Determine if given hash {@code key} exists.
|
||||
* Determine if given hash {@code key} exists at the bound key.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
@@ -43,7 +47,23 @@ public interface BoundHashOperations<H, HK, HV> extends BoundKeyOperations<H> {
|
||||
Boolean hasKey(Object key);
|
||||
|
||||
/**
|
||||
* Increment {@code value} of a hash {@code key} by the given {@code delta}.
|
||||
* Get value for given {@code key} from the hash at the bound key.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
*/
|
||||
HV get(Object key);
|
||||
|
||||
/**
|
||||
* Get values for given {@code keys} from the hash at the bound key.
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
*/
|
||||
List<HV> multiGet(Collection<HK> keys);
|
||||
|
||||
/**
|
||||
* Increment {@code value} of a hash {@code key} by the given {@code delta} at the bound key.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param delta
|
||||
@@ -52,7 +72,7 @@ public interface BoundHashOperations<H, HK, HV> extends BoundKeyOperations<H> {
|
||||
Long increment(HK key, long delta);
|
||||
|
||||
/**
|
||||
* Increment {@code value} of a hash {@code key} by the given {@code delta}.
|
||||
* Increment {@code value} of a hash {@code key} by the given {@code delta} at the bound key.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param delta
|
||||
@@ -61,15 +81,28 @@ public interface BoundHashOperations<H, HK, HV> extends BoundKeyOperations<H> {
|
||||
Double increment(HK key, double delta);
|
||||
|
||||
/**
|
||||
* Get value for given {@code key} from the hash.
|
||||
* Get key set (fields) of hash at the bound key.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
*/
|
||||
HV get(Object key);
|
||||
Set<HK> keys();
|
||||
|
||||
/**
|
||||
* Set the {@code value} of a hash {@code key}.
|
||||
* Get size of hash at the bound key.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Long size();
|
||||
|
||||
/**
|
||||
* Set multiple hash fields to multiple values using data provided in {@code m} at the bound key.
|
||||
*
|
||||
* @param m must not be {@literal null}.
|
||||
*/
|
||||
void putAll(Map<? extends HK, ? extends HV> m);
|
||||
|
||||
/**
|
||||
* Set the {@code value} of a hash {@code key} at the bound key.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value
|
||||
@@ -86,51 +119,14 @@ public interface BoundHashOperations<H, HK, HV> extends BoundKeyOperations<H> {
|
||||
Boolean putIfAbsent(HK key, HV value);
|
||||
|
||||
/**
|
||||
* Get values for given {@code keys} from the hash.
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
*/
|
||||
List<HV> multiGet(Collection<HK> keys);
|
||||
|
||||
/**
|
||||
* Set multiple hash fields to multiple values using data provided in {@code m}.
|
||||
*
|
||||
* @param m must not be {@literal null}.
|
||||
*/
|
||||
void putAll(Map<? extends HK, ? extends HV> m);
|
||||
|
||||
/**
|
||||
* Get key set (fields) of the hash.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Set<HK> keys();
|
||||
|
||||
/**
|
||||
* Get entry set (values) of hash.
|
||||
* Get entry set (values) of hash at the bound key.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<HV> values();
|
||||
|
||||
/**
|
||||
* Get size of the hash.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Long size();
|
||||
|
||||
/**
|
||||
* Delete given hash {@code keys}.
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
*/
|
||||
Long delete(Object... keys);
|
||||
|
||||
/**
|
||||
* Get entire hash.
|
||||
* Get entire hash at the bound key.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -144,4 +140,9 @@ public interface BoundHashOperations<H, HK, HV> extends BoundKeyOperations<H> {
|
||||
* @since 1.4
|
||||
*/
|
||||
Cursor<Map.Entry<HK, HV>> scan(ScanOptions options);
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
RedisOperations<H, ?> getOperations();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2014 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,11 +24,12 @@ import org.springframework.data.redis.connection.DataType;
|
||||
* Operations over a Redis key. Useful for executing common key-'bound' operations to all implementations.
|
||||
* <p>
|
||||
* As the rest of the APIs, if the underlying connection is pipelined or queued/in multi mode, all methods will return
|
||||
* null.
|
||||
* {@literal null}.
|
||||
* <p>
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface BoundKeyOperations<K> {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2013 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,44 +22,174 @@ import java.util.concurrent.TimeUnit;
|
||||
* List operations bound to a certain key.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface BoundListOperations<K, V> extends BoundKeyOperations<K> {
|
||||
|
||||
RedisOperations<K, V> getOperations();
|
||||
|
||||
/**
|
||||
* Get elements between {@code begin} and {@code end} from list at the bound key.
|
||||
*
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lrange">Redis Documentation: LRANGE</a>
|
||||
*/
|
||||
List<V> range(long start, long end);
|
||||
|
||||
/**
|
||||
* Trim list at the bound key to elements between {@code start} and {@code end}.
|
||||
*
|
||||
* @param start
|
||||
* @param end
|
||||
* @see <a href="http://redis.io/commands/ltrim">Redis Documentation: LTRIM</a>
|
||||
*/
|
||||
void trim(long start, long end);
|
||||
|
||||
/**
|
||||
* Get the size of list stored at the bound key.
|
||||
*
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/llen">Redis Documentation: LLEN</a>
|
||||
*/
|
||||
Long size();
|
||||
|
||||
/**
|
||||
* Prepend {@code value} to the bound key.
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lpush">Redis Documentation: LPUSH</a>
|
||||
*/
|
||||
Long leftPush(V value);
|
||||
|
||||
/**
|
||||
* Prepend {@code values} to the bound key.
|
||||
*
|
||||
* @param values
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lpush">Redis Documentation: LPUSH</a>
|
||||
*/
|
||||
Long leftPushAll(V... values);
|
||||
|
||||
/**
|
||||
* Prepend {@code values} to the bound key only if the list exists.
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lpushx">Redis Documentation: LPUSHX</a>
|
||||
*/
|
||||
Long leftPushIfPresent(V value);
|
||||
|
||||
/**
|
||||
* Prepend {@code values} to the bound key before {@code value}.
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lpush">Redis Documentation: LPUSH</a>
|
||||
*/
|
||||
Long leftPush(V pivot, V value);
|
||||
|
||||
/**
|
||||
* Append {@code value} to the bound key.
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/rpush">Redis Documentation: RPUSH</a>
|
||||
*/
|
||||
Long rightPush(V value);
|
||||
|
||||
/**
|
||||
* Append {@code values} to the bound key.
|
||||
*
|
||||
* @param values
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/rpush">Redis Documentation: RPUSH</a>
|
||||
*/
|
||||
Long rightPushAll(V... values);
|
||||
|
||||
/**
|
||||
* Append {@code values} to the bound key only if the list exists.
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/rpushx">Redis Documentation: RPUSHX</a>
|
||||
*/
|
||||
Long rightPushIfPresent(V value);
|
||||
|
||||
/**
|
||||
* Append {@code values} to the bound key before {@code value}.
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lpush">Redis Documentation: RPUSH</a>
|
||||
*/
|
||||
Long rightPush(V pivot, V value);
|
||||
|
||||
V leftPop();
|
||||
/**
|
||||
* Set the {@code value} list element at {@code index}.
|
||||
*
|
||||
* @param index
|
||||
* @param value
|
||||
* @see <a href="http://redis.io/commands/lset">Redis Documentation: LSET</a>
|
||||
*/
|
||||
void set(long index, V value);
|
||||
|
||||
V leftPop(long timeout, TimeUnit unit);
|
||||
|
||||
V rightPop();
|
||||
|
||||
V rightPop(long timeout, TimeUnit unit);
|
||||
|
||||
Long remove(long i, Object value);
|
||||
/**
|
||||
* Removes the first {@code count} occurrences of {@code value} from the list stored at the bound key.
|
||||
*
|
||||
* @param count
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lrem">Redis Documentation: LREM</a>
|
||||
*/
|
||||
Long remove(long count, Object value);
|
||||
|
||||
/**
|
||||
* Get element at {@code index} form list at the bound key.
|
||||
*
|
||||
* @param index
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lindex">Redis Documentation: LINDEX</a>
|
||||
*/
|
||||
V index(long index);
|
||||
|
||||
void set(long index, V value);
|
||||
/**
|
||||
* Removes and returns first element in list stored at the bound key.
|
||||
*
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lpop">Redis Documentation: LPOP</a>
|
||||
*/
|
||||
V leftPop();
|
||||
|
||||
/**
|
||||
* Removes and returns first element from lists stored at the bound key . <br>
|
||||
* <b>Blocks connection</b> until element available or {@code timeout} reached.
|
||||
*
|
||||
* @param timeout
|
||||
* @param unit must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/blpop">Redis Documentation: BLPOP</a>
|
||||
*/
|
||||
V leftPop(long timeout, TimeUnit unit);
|
||||
|
||||
/**
|
||||
* Removes and returns last element in list stored at the bound key.
|
||||
*
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/rpop">Redis Documentation: RPOP</a>
|
||||
*/
|
||||
V rightPop();
|
||||
|
||||
/**
|
||||
* Removes and returns last element from lists stored at the bound key. <br>
|
||||
* <b>Blocks connection</b> until element available or {@code timeout} reached.
|
||||
*
|
||||
* @param timeout
|
||||
* @param unit must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/brpop">Redis Documentation: BRPOP</a>
|
||||
*/
|
||||
V rightPop(long timeout, TimeUnit unit);
|
||||
|
||||
RedisOperations<K, V> getOperations();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2013 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.redis.core;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -24,59 +23,218 @@ import java.util.Set;
|
||||
* Set operations bound to a certain key.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface BoundSetOperations<K, V> extends BoundKeyOperations<K> {
|
||||
|
||||
RedisOperations<K, V> getOperations();
|
||||
|
||||
Set<V> diff(K key);
|
||||
|
||||
Set<V> diff(Collection<K> keys);
|
||||
|
||||
void diffAndStore(K key, K destKey);
|
||||
|
||||
void diffAndStore(Collection<K> keys, K destKey);
|
||||
|
||||
Set<V> intersect(K key);
|
||||
|
||||
Set<V> intersect(Collection<K> keys);
|
||||
|
||||
void intersectAndStore(K key, K destKey);
|
||||
|
||||
void intersectAndStore(Collection<K> keys, K destKey);
|
||||
|
||||
Set<V> union(K key);
|
||||
|
||||
Set<V> union(Collection<K> keys);
|
||||
|
||||
void unionAndStore(K key, K destKey);
|
||||
|
||||
void unionAndStore(Collection<K> keys, K destKey);
|
||||
|
||||
/**
|
||||
* Add given {@code values} to set at the bound key.
|
||||
*
|
||||
* @param values
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sadd">Redis Documentation: SADD</a>
|
||||
*/
|
||||
Long add(V... values);
|
||||
|
||||
Boolean isMember(Object o);
|
||||
|
||||
Set<V> members();
|
||||
|
||||
Boolean move(K destKey, V value);
|
||||
|
||||
V randomMember();
|
||||
|
||||
Set<V> distinctRandomMembers(long count);
|
||||
|
||||
List<V> randomMembers(long count);
|
||||
|
||||
/**
|
||||
* Remove given {@code values} from set at the bound key and return the number of removed elements.
|
||||
*
|
||||
* @param values
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/srem">Redis Documentation: SREM</a>
|
||||
*/
|
||||
Long remove(Object... values);
|
||||
|
||||
/**
|
||||
* Remove and return a random member from set at the bound key.
|
||||
*
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/spop">Redis Documentation: SPOP</a>
|
||||
*/
|
||||
V pop();
|
||||
|
||||
/**
|
||||
* Move {@code value} from the bound key to {@code destKey}
|
||||
*
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/smove">Redis Documentation: SMOVE</a>
|
||||
*/
|
||||
Boolean move(K destKey, V value);
|
||||
|
||||
/**
|
||||
* Get size of set at the bound key.
|
||||
*
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/scard">Redis Documentation: SCARD</a>
|
||||
*/
|
||||
Long size();
|
||||
|
||||
/**
|
||||
* Check if set at the bound key contains {@code value}.
|
||||
*
|
||||
* @param o
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sismember">Redis Documentation: SISMEMBER</a>
|
||||
*/
|
||||
Boolean isMember(Object o);
|
||||
|
||||
/**
|
||||
* Returns the members intersecting all given sets at the bound key and {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sinter">Redis Documentation: SINTER</a>
|
||||
*/
|
||||
Set<V> intersect(K key);
|
||||
|
||||
/**
|
||||
* Returns the members intersecting all given sets at the bound key and {@code keys}.
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sinter">Redis Documentation: SINTER</a>
|
||||
*/
|
||||
Set<V> intersect(Collection<K> keys);
|
||||
|
||||
/**
|
||||
* Intersect all given sets at the bound key and {@code key} and store result in {@code destKey}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sinterstore">Redis Documentation: SINTERSTORE</a>
|
||||
*/
|
||||
void intersectAndStore(K key, K destKey);
|
||||
|
||||
/**
|
||||
* Intersect all given sets at the bound key and {@code keys} and store result in {@code destKey}.
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sinterstore">Redis Documentation: SINTERSTORE</a>
|
||||
*/
|
||||
void intersectAndStore(Collection<K> keys, K destKey);
|
||||
|
||||
/**
|
||||
* Union all sets at given {@code key} and {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sunion">Redis Documentation: SUNION</a>
|
||||
*/
|
||||
Set<V> union(K key);
|
||||
|
||||
/**
|
||||
* Union all sets at given {@code keys} and {@code keys}.
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sunion">Redis Documentation: SUNION</a>
|
||||
*/
|
||||
Set<V> union(Collection<K> keys);
|
||||
|
||||
/**
|
||||
* Union all sets at given the bound key and {@code key} and store result in {@code destKey}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sunionstore">Redis Documentation: SUNIONSTORE</a>
|
||||
*/
|
||||
void unionAndStore(K key, K destKey);
|
||||
|
||||
/**
|
||||
* Union all sets at given the bound key and {@code keys} and store result in {@code destKey}.
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sunionstore">Redis Documentation: SUNIONSTORE</a>
|
||||
*/
|
||||
void unionAndStore(Collection<K> keys, K destKey);
|
||||
|
||||
/**
|
||||
* Diff all sets for given the bound key and {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sdiff">Redis Documentation: SDIFF</a>
|
||||
*/
|
||||
Set<V> diff(K key);
|
||||
|
||||
/**
|
||||
* Diff all sets for given the bound key and {@code keys}.
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sdiff">Redis Documentation: SDIFF</a>
|
||||
*/
|
||||
Set<V> diff(Collection<K> keys);
|
||||
|
||||
/**
|
||||
* Diff all sets for given the bound key and {@code keys} and store result in {@code destKey}.
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sdiffstore">Redis Documentation: SDIFFSTORE</a>
|
||||
*/
|
||||
void diffAndStore(K keys, K destKey);
|
||||
|
||||
/**
|
||||
* Diff all sets for given the bound key and {@code keys} and store result in {@code destKey}.
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sdiffstore">Redis Documentation: SDIFFSTORE</a>
|
||||
*/
|
||||
void diffAndStore(Collection<K> keys, K destKey);
|
||||
|
||||
/**
|
||||
* Get all elements of set at the bound key.
|
||||
*
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/smembers">Redis Documentation: SMEMBERS</a>
|
||||
*/
|
||||
Set<V> members();
|
||||
|
||||
/**
|
||||
* Get random element from set at the bound key.
|
||||
*
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/srandmember">Redis Documentation: SRANDMEMBER</a>
|
||||
*/
|
||||
V randomMember();
|
||||
|
||||
/**
|
||||
* Get {@code count} distinct random elements from set at the bound key.
|
||||
*
|
||||
* @param count
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/srandmember">Redis Documentation: SRANDMEMBER</a>
|
||||
*/
|
||||
Set<V> distinctRandomMembers(long count);
|
||||
|
||||
/**
|
||||
* Get {@code count} random elements from set at the bound key.
|
||||
*
|
||||
* @param count
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/srandmember">Redis Documentation: SRANDMEMBER</a>
|
||||
*/
|
||||
List<V> randomMembers(long count);
|
||||
|
||||
/**
|
||||
* @param options
|
||||
* @return
|
||||
* @since 1.4
|
||||
*/
|
||||
Cursor<V> scan(ScanOptions options);
|
||||
|
||||
RedisOperations<K, V> getOperations();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2013 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,30 +21,98 @@ import java.util.concurrent.TimeUnit;
|
||||
* Value (or String in Redis terminology) operations bound to a certain key.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface BoundValueOperations<K, V> extends BoundKeyOperations<K> {
|
||||
|
||||
RedisOperations<K, V> getOperations();
|
||||
|
||||
/**
|
||||
* Set {@code value} for the bound key.
|
||||
*
|
||||
* @param value
|
||||
* @see <a href="http://redis.io/commands/set">Redis Documentation: SET</a>
|
||||
*/
|
||||
void set(V value);
|
||||
|
||||
void set(V value, long offset);
|
||||
|
||||
/**
|
||||
* Set the {@code value} and expiration {@code timeout} for the bound key.
|
||||
*
|
||||
* @param value
|
||||
* @param timeout
|
||||
* @param unit must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/setex">Redis Documentation: SETEX</a>
|
||||
*/
|
||||
void set(V value, long timeout, TimeUnit unit);
|
||||
|
||||
/**
|
||||
* Set the bound key to hold the string {@code value} if the bound key is absent.
|
||||
*
|
||||
* @param value
|
||||
* @see <a href="http://redis.io/commands/setnx">Redis Documentation: SETNX</a>
|
||||
*/
|
||||
Boolean setIfAbsent(V value);
|
||||
|
||||
/**
|
||||
* Get the value of the bound key.
|
||||
*
|
||||
* @see <a href="http://redis.io/commands/get">Redis Documentation: GET</a>
|
||||
*/
|
||||
V get();
|
||||
|
||||
String get(long start, long end);
|
||||
|
||||
/**
|
||||
* Set {@code value} of the bound key and return its old value.
|
||||
*
|
||||
* @see <a href="http://redis.io/commands/getset">Redis Documentation: GETSET</a>
|
||||
*/
|
||||
V getAndSet(V value);
|
||||
|
||||
/**
|
||||
* Increment an integer value stored as string value under the bound key by {@code delta}.
|
||||
*
|
||||
* @param delta
|
||||
* @see <a href="http://redis.io/commands/incr">Redis Documentation: INCR</a>
|
||||
*/
|
||||
Long increment(long delta);
|
||||
|
||||
/**
|
||||
* Increment a floating point number value stored as string value under the bound key by {@code delta}.
|
||||
*
|
||||
* @param delta
|
||||
* @see <a href="http://redis.io/commands/incrbyfloar">Redis Documentation: INCRBYFLOAT</a>
|
||||
*/
|
||||
Double increment(double delta);
|
||||
|
||||
/**
|
||||
* Append a {@code value} to the bound key.
|
||||
*
|
||||
* @param value
|
||||
* @see <a href="http://redis.io/commands/append">Redis Documentation: APPEND</a>
|
||||
*/
|
||||
Integer append(String value);
|
||||
|
||||
/**
|
||||
* Get a substring of value of the bound key between {@code begin} and {@code end}.
|
||||
*
|
||||
* @param start
|
||||
* @param end
|
||||
* @see <a href="http://redis.io/commands/getrange">Redis Documentation: GETRANGE</a>
|
||||
*/
|
||||
String get(long start, long end);
|
||||
|
||||
/**
|
||||
* Overwrite parts of the bound key starting at the specified {@code offset} with given {@code value}.
|
||||
*
|
||||
* @param value
|
||||
* @param offset
|
||||
* @see <a href="http://redis.io/commands/setrange">Redis Documentation: SETRANGE</a>
|
||||
*/
|
||||
void set(V value, long offset);
|
||||
|
||||
/**
|
||||
* Get the length of the value stored at the bound key.
|
||||
*
|
||||
* @see <a href="http://redis.io/commands/strlen">Redis Documentation: STRLEN</a>
|
||||
*/
|
||||
Long size();
|
||||
|
||||
RedisOperations<K, V> getOperations();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2016 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.redis.core;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -21,6 +20,7 @@ import java.util.Set;
|
||||
|
||||
import org.springframework.data.redis.connection.RedisZSetCommands.Limit;
|
||||
import org.springframework.data.redis.connection.RedisZSetCommands.Range;
|
||||
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple;
|
||||
import org.springframework.data.redis.core.ZSetOperations.TypedTuple;
|
||||
|
||||
/**
|
||||
@@ -32,34 +32,257 @@ import org.springframework.data.redis.core.ZSetOperations.TypedTuple;
|
||||
*/
|
||||
public interface BoundZSetOperations<K, V> extends BoundKeyOperations<K> {
|
||||
|
||||
RedisOperations<K, V> getOperations();
|
||||
/**
|
||||
* Add {@code value} to a sorted set at the bound key, or update its {@code score} if it already exists.
|
||||
*
|
||||
* @param score the score.
|
||||
* @param value the value.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zadd">Redis Documentation: ZADD</a>
|
||||
*/
|
||||
Boolean add(V value, double score);
|
||||
|
||||
void intersectAndStore(K otherKey, K destKey);
|
||||
/**
|
||||
* Add {@code tuples} to a sorted set at the bound key, or update its {@code score} if it already exists.
|
||||
*
|
||||
* @param tuples must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zadd">Redis Documentation: ZADD</a>
|
||||
*/
|
||||
Long add(Set<TypedTuple<V>> tuples);
|
||||
|
||||
void intersectAndStore(Collection<K> otherKeys, K destKey);
|
||||
/**
|
||||
* Remove {@code values} from sorted set. Return number of removed elements.
|
||||
*
|
||||
* @param values must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrem">Redis Documentation: ZREM</a>
|
||||
*/
|
||||
Long remove(Object... values);
|
||||
|
||||
/**
|
||||
* Increment the score of element with {@code value} in sorted set by {@code increment}.
|
||||
*
|
||||
* @param delta
|
||||
* @param value the value.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zincrby">Redis Documentation: ZINCRBY</a>
|
||||
*/
|
||||
Double incrementScore(V value, double delta);
|
||||
|
||||
/**
|
||||
* Determine the index of element with {@code value} in a sorted set.
|
||||
*
|
||||
* @param o the value.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrank">Redis Documentation: ZRANK</a>
|
||||
*/
|
||||
Long rank(Object o);
|
||||
|
||||
/**
|
||||
* Determine the index of element with {@code value} in a sorted set when scored high to low.
|
||||
*
|
||||
* @param o the value.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrank">Redis Documentation: ZREVRANK</a>
|
||||
*/
|
||||
Long reverseRank(Object o);
|
||||
|
||||
/**
|
||||
* Get elements between {@code start} and {@code end} from sorted set.
|
||||
*
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrange">Redis Documentation: ZRANGE</a>
|
||||
*/
|
||||
Set<V> range(long start, long end);
|
||||
|
||||
Set<V> rangeByScore(double min, double max);
|
||||
|
||||
Set<V> reverseRange(long start, long end);
|
||||
|
||||
Set<V> reverseRangeByScore(double min, double max);
|
||||
|
||||
/**
|
||||
* Get set of {@link Tuple}s between {@code start} and {@code end} from sorted set.
|
||||
*
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrange">Redis Documentation: ZRANGE</a>
|
||||
*/
|
||||
Set<TypedTuple<V>> rangeWithScores(long start, long end);
|
||||
|
||||
/**
|
||||
* Get elements where score is between {@code min} and {@code max} from sorted set.
|
||||
*
|
||||
* @param min
|
||||
* @param max
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<V> rangeByScore(double min, double max);
|
||||
|
||||
/**
|
||||
* Get set of {@link Tuple}s where score is between {@code min} and {@code max} from sorted set.
|
||||
*
|
||||
* @param min
|
||||
* @param max
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<TypedTuple<V>> rangeByScoreWithScores(double min, double max);
|
||||
|
||||
/**
|
||||
* Get elements in range from {@code start} to {@code end} from sorted set ordered from high to low.
|
||||
*
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrange">Redis Documentation: ZREVRANGE</a>
|
||||
*/
|
||||
Set<V> reverseRange(long start, long end);
|
||||
|
||||
/**
|
||||
* Get set of {@link Tuple}s in range from {@code start} to {@code end} from sorted set ordered from high to low.
|
||||
*
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrange">Redis Documentation: ZREVRANGE</a>
|
||||
*/
|
||||
Set<TypedTuple<V>> reverseRangeWithScores(long start, long end);
|
||||
|
||||
/**
|
||||
* Get elements where score is between {@code min} and {@code max} from sorted set ordered from high to low.
|
||||
*
|
||||
* @param min
|
||||
* @param max
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrange">Redis Documentation: ZREVRANGE</a>
|
||||
*/
|
||||
Set<V> reverseRangeByScore(double min, double max);
|
||||
|
||||
/**
|
||||
* Get set of {@link Tuple} where score is between {@code min} and {@code max} from sorted set ordered from high to
|
||||
* low.
|
||||
*
|
||||
* @param min
|
||||
* @param max
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrangebyscore">Redis Documentation: ZREVRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<TypedTuple<V>> reverseRangeByScoreWithScores(double min, double max);
|
||||
|
||||
/**
|
||||
* Count number of elements within sorted set with scores between {@code min} and {@code max}.
|
||||
*
|
||||
* @param min
|
||||
* @param max
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zcount">Redis Documentation: ZCOUNT</a>
|
||||
*/
|
||||
Long count(double min, double max);
|
||||
|
||||
/**
|
||||
* Returns the number of elements of the sorted set stored with given the bound key.
|
||||
*
|
||||
* @see #zCard()
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zcard">Redis Documentation: ZCARD</a>
|
||||
*/
|
||||
Long size();
|
||||
|
||||
/**
|
||||
* Get the size of sorted set with the bound key.
|
||||
*
|
||||
* @return
|
||||
* @since 1.3
|
||||
* @see <a href="http://redis.io/commands/zcard">Redis Documentation: ZCARD</a>
|
||||
*/
|
||||
Long zCard();
|
||||
|
||||
/**
|
||||
* Get the score of element with {@code value} from sorted set with key the bound key.
|
||||
*
|
||||
* @param o the value.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrem">Redis Documentation: ZREM</a>
|
||||
*/
|
||||
Double score(Object o);
|
||||
|
||||
/**
|
||||
* Remove elements in range between {@code start} and {@code end} from sorted set with the bound key.
|
||||
*
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zremrangebyrank">Redis Documentation: ZREMRANGEBYRANK</a>
|
||||
*/
|
||||
void removeRange(long start, long end);
|
||||
|
||||
/**
|
||||
* Remove elements with scores between {@code min} and {@code max} from sorted set with the bound key.
|
||||
*
|
||||
* @param min
|
||||
* @param max
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zremrangebyscore">Redis Documentation: ZREMRANGEBYSCORE</a>
|
||||
*/
|
||||
void removeRangeByScore(double min, double max);
|
||||
|
||||
/**
|
||||
* Union sorted sets at the bound key and {@code otherKeys} and store result in destination {@code destKey}.
|
||||
*
|
||||
* @param otherKey must not be {@literal null}.
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zunionstore">Redis Documentation: ZUNIONSTORE</a>
|
||||
*/
|
||||
void unionAndStore(K otherKey, K destKey);
|
||||
|
||||
/**
|
||||
* Union sorted sets at the bound key and {@code otherKeys} and store result in destination {@code destKey}.
|
||||
*
|
||||
* @param otherKeys must not be {@literal null}.
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zunionstore">Redis Documentation: ZUNIONSTORE</a>
|
||||
*/
|
||||
void unionAndStore(Collection<K> otherKeys, K destKey);
|
||||
|
||||
/**
|
||||
* Intersect sorted sets at the bound key and {@code otherKey} and store result in destination {@code destKey}.
|
||||
*
|
||||
* @param otherKey must not be {@literal null}.
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zinterstore">Redis Documentation: ZINTERSTORE</a>
|
||||
*/
|
||||
void intersectAndStore(K otherKey, K destKey);
|
||||
|
||||
/**
|
||||
* Intersect sorted sets at the bound key and {@code otherKeys} and store result in destination {@code destKey}.
|
||||
*
|
||||
* @param otherKeys must not be {@literal null}.
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zinterstore">Redis Documentation: ZINTERSTORE</a>
|
||||
*/
|
||||
void intersectAndStore(Collection<K> otherKeys, K destKey);
|
||||
|
||||
/**
|
||||
* Iterate over elements in zset at the bound key. <br />
|
||||
* <strong>Important:</strong> Call {@link Cursor#close()} when done to avoid resource leak.
|
||||
*
|
||||
* @param options
|
||||
* @return
|
||||
* @since 1.4
|
||||
*/
|
||||
Cursor<TypedTuple<V>> scan(ScanOptions options);
|
||||
|
||||
/**
|
||||
* Get all elements with lexicographical ordering with a value between {@link Range#getMin()} and
|
||||
* {@link Range#getMax()}.
|
||||
*
|
||||
*
|
||||
* @param range must not be {@literal null}.
|
||||
* @since 1.7
|
||||
* @see <a href="http://redis.io/commands/zrangebylex">Redis Documentation: ZRANGEBYLEX</a>
|
||||
*/
|
||||
Set<V> rangeByLex(Range range);
|
||||
|
||||
@@ -67,58 +290,14 @@ public interface BoundZSetOperations<K, V> extends BoundKeyOperations<K> {
|
||||
* Get all elements {@literal n} elements, where {@literal n = } {@link Limit#getCount()}, starting at
|
||||
* {@link Limit#getOffset()} with lexicographical ordering having a value between {@link Range#getMin()} and
|
||||
* {@link Range#getMax()}.
|
||||
*
|
||||
*
|
||||
* @param range must not be {@literal null}.
|
||||
* @param limit can be {@literal null}.
|
||||
* @return
|
||||
* @since 1.7
|
||||
* @see <a href="http://redis.io/commands/zrangebylex">Redis Documentation: ZRANGEBYLEX</a>
|
||||
*/
|
||||
Set<V> rangeByLex(Range range, Limit limit);
|
||||
|
||||
void removeRange(long start, long end);
|
||||
|
||||
void removeRangeByScore(double min, double max);
|
||||
|
||||
void unionAndStore(K otherKey, K destKey);
|
||||
|
||||
void unionAndStore(Collection<K> otherKeys, K destKey);
|
||||
|
||||
Boolean add(V value, double score);
|
||||
|
||||
Long add(Set<TypedTuple<V>> tuples);
|
||||
|
||||
Double incrementScore(V value, double delta);
|
||||
|
||||
Long rank(Object o);
|
||||
|
||||
Long reverseRank(Object o);
|
||||
|
||||
Long remove(Object... values);
|
||||
|
||||
Long count(double min, double max);
|
||||
|
||||
/**
|
||||
* Returns the number of elements of the sorted set.
|
||||
*
|
||||
* @return
|
||||
* @see #zCard()
|
||||
*/
|
||||
Long size();
|
||||
|
||||
/**
|
||||
* Returns the number of elements of the sorted set.
|
||||
*
|
||||
* @return
|
||||
* @since 1.3
|
||||
*/
|
||||
Long zCard();
|
||||
|
||||
Double score(Object o);
|
||||
|
||||
/**
|
||||
* @param options
|
||||
* @return
|
||||
* @since 1.4
|
||||
*/
|
||||
Cursor<TypedTuple<V>> scan(ScanOptions options);
|
||||
RedisOperations<K, V> getOperations();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,7 +31,8 @@ import org.springframework.data.redis.connection.RedisGeoCommands.GeoRadiusComma
|
||||
*
|
||||
* @author Ninad Divadkar
|
||||
* @author Christoph Strobl
|
||||
* @see <a href="http://redis.io/commands#geo">http://redis.io/commands#geo</a>
|
||||
* @author Mark Paluch
|
||||
* @see <a href="http://redis.io/commands#geo">Redis Documentation: Geo Commands</a>
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface GeoOperations<K, M> {
|
||||
@@ -43,7 +44,7 @@ public interface GeoOperations<K, M> {
|
||||
* @param point must not be {@literal null}.
|
||||
* @param member must not be {@literal null}.
|
||||
* @return Number of elements added.
|
||||
* @see <a href="http://redis.io/commands/geoadd">http://redis.io/commands/geoadd</a>
|
||||
* @see <a href="http://redis.io/commands/geoadd">Redis Documentation: GEOADD</a>
|
||||
*/
|
||||
Long geoAdd(K key, Point point, M member);
|
||||
|
||||
@@ -53,7 +54,7 @@ public interface GeoOperations<K, M> {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param location must not be {@literal null}.
|
||||
* @return Number of elements added.
|
||||
* @see <a href="http://redis.io/commands/geoadd">http://redis.io/commands/geoadd</a>
|
||||
* @see <a href="http://redis.io/commands/geoadd">Redis Documentation: GEOADD</a>
|
||||
*/
|
||||
Long geoAdd(K key, GeoLocation<M> location);
|
||||
|
||||
@@ -63,7 +64,7 @@ public interface GeoOperations<K, M> {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param memberCoordinateMap must not be {@literal null}.
|
||||
* @return Number of elements added.
|
||||
* @see <a href="http://redis.io/commands/geoadd">http://redis.io/commands/geoadd</a>
|
||||
* @see <a href="http://redis.io/commands/geoadd">Redis Documentation: GEOADD</a>
|
||||
*/
|
||||
Long geoAdd(K key, Map<M, Point> memberCoordinateMap);
|
||||
|
||||
@@ -73,7 +74,7 @@ public interface GeoOperations<K, M> {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param locations must not be {@literal null}.
|
||||
* @return Number of elements added.
|
||||
* @see <a href="http://redis.io/commands/geoadd">http://redis.io/commands/geoadd</a>
|
||||
* @see <a href="http://redis.io/commands/geoadd">Redis Documentation: GEOADD</a>
|
||||
*/
|
||||
Long geoAdd(K key, Iterable<GeoLocation<M>> locations);
|
||||
|
||||
@@ -84,7 +85,7 @@ public interface GeoOperations<K, M> {
|
||||
* @param member1 must not be {@literal null}.
|
||||
* @param member2 must not be {@literal null}.
|
||||
* @return can be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/geodist">http://redis.io/commands/geodist</a>
|
||||
* @see <a href="http://redis.io/commands/geodist">Redis Documentation: GEODIST</a>
|
||||
*/
|
||||
Distance geoDist(K key, M member1, M member2);
|
||||
|
||||
@@ -96,7 +97,7 @@ public interface GeoOperations<K, M> {
|
||||
* @param member2 must not be {@literal null}.
|
||||
* @param metric must not be {@literal null}.
|
||||
* @return can be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/geodist">http://redis.io/commands/geodist</a>
|
||||
* @see <a href="http://redis.io/commands/geodist">Redis Documentation: GEODIST</a>
|
||||
*/
|
||||
Distance geoDist(K key, M member1, M member2, Metric metric);
|
||||
|
||||
@@ -106,7 +107,7 @@ public interface GeoOperations<K, M> {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param members must not be {@literal null}.
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/geohash">http://redis.io/commands/geohash</a>
|
||||
* @see <a href="http://redis.io/commands/geohash">Redis Documentation: GEOHASH</a>
|
||||
*/
|
||||
List<String> geoHash(K key, M... members);
|
||||
|
||||
@@ -116,7 +117,7 @@ public interface GeoOperations<K, M> {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param members must not be {@literal null}.
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/geopos">http://redis.io/commands/geopos</a>
|
||||
* @see <a href="http://redis.io/commands/geopos">Redis Documentation: GEOPOS</a>
|
||||
*/
|
||||
List<Point> geoPos(K key, M... members);
|
||||
|
||||
@@ -126,7 +127,7 @@ public interface GeoOperations<K, M> {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param within must not be {@literal null}.
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/georadius">http://redis.io/commands/georadius</a>
|
||||
* @see <a href="http://redis.io/commands/georadius">Redis Documentation: GEORADIUS</a>
|
||||
*/
|
||||
GeoResults<GeoLocation<M>> geoRadius(K key, Circle within);
|
||||
|
||||
@@ -137,7 +138,7 @@ public interface GeoOperations<K, M> {
|
||||
* @param within must not be {@literal null}.
|
||||
* @param args must not be {@literal null}.
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/georadius">http://redis.io/commands/georadius</a>
|
||||
* @see <a href="http://redis.io/commands/georadius">Redis Documentation: GEORADIUS</a>
|
||||
*/
|
||||
GeoResults<GeoLocation<M>> geoRadius(K key, Circle within, GeoRadiusCommandArgs args);
|
||||
|
||||
@@ -149,7 +150,7 @@ public interface GeoOperations<K, M> {
|
||||
* @param member must not be {@literal null}.
|
||||
* @param radius
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/georadiusbymember">http://redis.io/commands/georadiusbymember</a>
|
||||
* @see <a href="http://redis.io/commands/georadiusbymember">Redis Documentation: GEORADIUSBYMEMBER</a>
|
||||
*/
|
||||
GeoResults<GeoLocation<M>> geoRadiusByMember(K key, M member, double radius);
|
||||
|
||||
@@ -161,7 +162,7 @@ public interface GeoOperations<K, M> {
|
||||
* @param member must not be {@literal null}.
|
||||
* @param distance must not be {@literal null}.
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/georadiusbymember">http://redis.io/commands/georadiusbymember</a>
|
||||
* @see <a href="http://redis.io/commands/georadiusbymember">Redis Documentation: GEORADIUSBYMEMBER</a>
|
||||
*/
|
||||
GeoResults<GeoLocation<M>> geoRadiusByMember(K key, M member, Distance distance);
|
||||
|
||||
@@ -174,7 +175,7 @@ public interface GeoOperations<K, M> {
|
||||
* @param distance must not be {@literal null}.
|
||||
* @param args must not be {@literal null}.
|
||||
* @return never {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/georadiusbymember">http://redis.io/commands/georadiusbymember</a>
|
||||
* @see <a href="http://redis.io/commands/georadiusbymember">Redis Documentation: GEORADIUSBYMEMBER</a>
|
||||
*/
|
||||
GeoResults<GeoLocation<M>> geoRadiusByMember(K key, M member, Distance distance, GeoRadiusCommandArgs args);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2016 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -144,19 +144,19 @@ public interface HashOperations<H, HK, HV> {
|
||||
*/
|
||||
Map<HK, HV> entries(H key);
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
RedisOperations<H, ?> getOperations();
|
||||
|
||||
/**
|
||||
* Use a {@link Cursor} to iterate over entries in hash at {@code key}. <br />
|
||||
* <strong>Important:</strong> Call {@link Cursor#close()} when done to avoid resource leak.
|
||||
*
|
||||
* @since 1.4
|
||||
* @param key must not be {@literal null}.
|
||||
* @param options
|
||||
* @return
|
||||
* @since 1.4
|
||||
*/
|
||||
Cursor<Map.Entry<HK, HV>> scan(H key, ScanOptions options);
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
RedisOperations<H, ?> getOperations();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2014 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,67 +26,236 @@ import java.util.concurrent.TimeUnit;
|
||||
* @author David Liu
|
||||
* @author Thomas Darimont
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface ListOperations<K, V> {
|
||||
|
||||
/**
|
||||
* Get elements between {@code begin} and {@code end} from list at {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lrange">Redis Documentation: LRANGE</a>
|
||||
*/
|
||||
List<V> range(K key, long start, long end);
|
||||
|
||||
/**
|
||||
* Trim list at {@code key} to elements between {@code start} and {@code end}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param start
|
||||
* @param end
|
||||
* @see <a href="http://redis.io/commands/ltrim">Redis Documentation: LTRIM</a>
|
||||
*/
|
||||
void trim(K key, long start, long end);
|
||||
|
||||
/**
|
||||
* Get the size of list stored at {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/llen">Redis Documentation: LLEN</a>
|
||||
*/
|
||||
Long size(K key);
|
||||
|
||||
/**
|
||||
* Prepend {@code value} to {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lpush">Redis Documentation: LPUSH</a>
|
||||
*/
|
||||
Long leftPush(K key, V value);
|
||||
|
||||
/**
|
||||
* Prepend {@code values} to {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param values
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lpush">Redis Documentation: LPUSH</a>
|
||||
*/
|
||||
Long leftPushAll(K key, V... values);
|
||||
|
||||
/**
|
||||
* Insert all {@literal values} at the head of the list stored at {@literal key}.
|
||||
*
|
||||
* Prepend {@code values} to {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param values must not be {@literal empty} nor contain {@literal null} values.
|
||||
* @param values must not be {@literal null}.
|
||||
* @return
|
||||
* @since 1.5
|
||||
* @see <a href="http://redis.io/commands/lpush">Redis Documentation: LPUSH</a>
|
||||
*/
|
||||
Long leftPushAll(K key, Collection<V> values);
|
||||
|
||||
/**
|
||||
* Prepend {@code values} to {@code key} only if the list exists.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lpushx">Redis Documentation: LPUSHX</a>
|
||||
*/
|
||||
Long leftPushIfPresent(K key, V value);
|
||||
|
||||
/**
|
||||
* Prepend {@code values} to {@code key} before {@code value}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lpush">Redis Documentation: LPUSH</a>
|
||||
*/
|
||||
Long leftPush(K key, V pivot, V value);
|
||||
|
||||
/**
|
||||
* Append {@code value} to {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/rpush">Redis Documentation: RPUSH</a>
|
||||
*/
|
||||
Long rightPush(K key, V value);
|
||||
|
||||
/**
|
||||
* Append {@code values} to {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param values
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/rpush">Redis Documentation: RPUSH</a>
|
||||
*/
|
||||
Long rightPushAll(K key, V... values);
|
||||
|
||||
/**
|
||||
* Insert all {@literal values} at the tail of the list stored at {@literal key}.
|
||||
*
|
||||
* Append {@code values} to {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param values must not be {@literal empty} nor contain {@literal null} values.
|
||||
* @param values
|
||||
* @return
|
||||
* @since 1.5
|
||||
* @see <a href="http://redis.io/commands/rpush">Redis Documentation: RPUSH</a>
|
||||
*/
|
||||
Long rightPushAll(K key, Collection<V> values);
|
||||
|
||||
/**
|
||||
* Append {@code values} to {@code key} only if the list exists.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/rpushx">Redis Documentation: RPUSHX</a>
|
||||
*/
|
||||
Long rightPushIfPresent(K key, V value);
|
||||
|
||||
/**
|
||||
* Append {@code values} to {@code key} before {@code value}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lpush">Redis Documentation: RPUSH</a>
|
||||
*/
|
||||
Long rightPush(K key, V pivot, V value);
|
||||
|
||||
/**
|
||||
* Set the {@code value} list element at {@code index}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param index
|
||||
* @param value
|
||||
* @see <a href="http://redis.io/commands/lset">Redis Documentation: LSET</a>
|
||||
*/
|
||||
void set(K key, long index, V value);
|
||||
|
||||
Long remove(K key, long i, Object value);
|
||||
/**
|
||||
* Removes the first {@code count} occurrences of {@code value} from the list stored at {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param count
|
||||
* @param value
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lrem">Redis Documentation: LREM</a>
|
||||
*/
|
||||
Long remove(K key, long count, Object value);
|
||||
|
||||
/**
|
||||
* Get element at {@code index} form list at {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param index
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lindex">Redis Documentation: LINDEX</a>
|
||||
*/
|
||||
V index(K key, long index);
|
||||
|
||||
/**
|
||||
* Removes and returns first element in list stored at {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/lpop">Redis Documentation: LPOP</a>
|
||||
*/
|
||||
V leftPop(K key);
|
||||
|
||||
/**
|
||||
* Removes and returns first element from lists stored at {@code key} . <br>
|
||||
* <b>Blocks connection</b> until element available or {@code timeout} reached.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param timeout
|
||||
* @param unit must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/blpop">Redis Documentation: BLPOP</a>
|
||||
*/
|
||||
V leftPop(K key, long timeout, TimeUnit unit);
|
||||
|
||||
/**
|
||||
* Removes and returns last element in list stored at {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/rpop">Redis Documentation: RPOP</a>
|
||||
*/
|
||||
V rightPop(K key);
|
||||
|
||||
/**
|
||||
* Removes and returns last element from lists stored at {@code key}. <br>
|
||||
* <b>Blocks connection</b> until element available or {@code timeout} reached.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param timeout
|
||||
* @param unit must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/brpop">Redis Documentation: BRPOP</a>
|
||||
*/
|
||||
V rightPop(K key, long timeout, TimeUnit unit);
|
||||
|
||||
/**
|
||||
* Remove the last element from list at {@code sourceKey}, append it to {@code destinationKey} and return its value.
|
||||
*
|
||||
* @param sourceKey must not be {@literal null}.
|
||||
* @param destinationKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/rpoplpush">Redis Documentation: RPOPLPUSH</a>
|
||||
*/
|
||||
V rightPopAndLeftPush(K sourceKey, K destinationKey);
|
||||
|
||||
/**
|
||||
* Remove the last element from list at {@code srcKey}, append it to {@code dstKey} and return its value.<br>
|
||||
* <b>Blocks connection</b> until element available or {@code timeout} reached.
|
||||
*
|
||||
* @param sourceKey must not be {@literal null}.
|
||||
* @param destinationKey must not be {@literal null}.
|
||||
* @param timeout
|
||||
* @param unit must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/brpoplpush">Redis Documentation: BRPOPLPUSH</a>
|
||||
*/
|
||||
V rightPopAndLeftPush(K sourceKey, K destinationKey, long timeout, TimeUnit unit);
|
||||
|
||||
RedisOperations<K, V> getOperations();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2016 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -36,6 +36,7 @@ import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
* @author Costin Leau
|
||||
* @author Christoph Strobl
|
||||
* @author Ninad Divadkar
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface RedisOperations<K, V> {
|
||||
|
||||
@@ -141,53 +142,272 @@ public interface RedisOperations<K, V> {
|
||||
*/
|
||||
<T extends Closeable> T executeWithStickyConnection(RedisCallback<T> callback);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Methods dealing with Redis Keys
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Determine if given {@code key} exists.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/exists">Redis Documentation: EXISTS</a>
|
||||
*/
|
||||
Boolean hasKey(K key);
|
||||
|
||||
/**
|
||||
* Delete given {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return The number of keys that were removed.
|
||||
* @see <a href="http://redis.io/commands/del">Redis Documentation: DEL</a>
|
||||
*/
|
||||
void delete(K key);
|
||||
|
||||
void delete(Collection<K> key);
|
||||
/**
|
||||
* Delete given {@code keys}.
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @return The number of keys that were removed.
|
||||
* @see <a href="http://redis.io/commands/del">Redis Documentation: DEL</a>
|
||||
*/
|
||||
void delete(Collection<K> keys);
|
||||
|
||||
/**
|
||||
* Determine the type stored at {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/type">Redis Documentation: TYPE</a>
|
||||
*/
|
||||
DataType type(K key);
|
||||
|
||||
/**
|
||||
* Find all keys matching the given {@code pattern}.
|
||||
*
|
||||
* @param pattern must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/keys">Redis Documentation: KEYS</a>
|
||||
*/
|
||||
Set<K> keys(K pattern);
|
||||
|
||||
/**
|
||||
* Return a random key from the keyspace.
|
||||
*
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/randomkey">Redis Documentation: RANDOMKEY</a>
|
||||
*/
|
||||
K randomKey();
|
||||
|
||||
/**
|
||||
* Rename key {@code oldKey} to {@code newKey}.
|
||||
*
|
||||
* @param oldKey must not be {@literal null}.
|
||||
* @param newKey must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/rename">Redis Documentation: RENAME</a>
|
||||
*/
|
||||
void rename(K oldKey, K newKey);
|
||||
|
||||
/**
|
||||
* Rename key {@code oleName} to {@code newKey} only if {@code newKey} does not exist.
|
||||
*
|
||||
* @param oldKey must not be {@literal null}.
|
||||
* @param newKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/renamenx">Redis Documentation: RENAMENX</a>
|
||||
*/
|
||||
Boolean renameIfAbsent(K oldKey, K newKey);
|
||||
|
||||
/**
|
||||
* Set time to live for given {@code key}..
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param timeout
|
||||
* @param unit must not be {@literal null}.
|
||||
* @return
|
||||
*/
|
||||
Boolean expire(K key, long timeout, TimeUnit unit);
|
||||
|
||||
/**
|
||||
* Set the expiration for given {@code key} as a {@literal date} timestamp.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param date must not be {@literal null}.
|
||||
* @return
|
||||
*/
|
||||
Boolean expireAt(K key, Date date);
|
||||
|
||||
/**
|
||||
* Remove the expiration from given {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/persist">Redis Documentation: PERSIST</a>
|
||||
*/
|
||||
Boolean persist(K key);
|
||||
|
||||
/**
|
||||
* Move given {@code key} to database with {@code index}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param dbIndex
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/move">Redis Documentation: MOVE</a>
|
||||
*/
|
||||
Boolean move(K key, int dbIndex);
|
||||
|
||||
/**
|
||||
* Retrieve serialized version of the value stored at {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/dump">Redis Documentation: DUMP</a>
|
||||
*/
|
||||
byte[] dump(K key);
|
||||
|
||||
/**
|
||||
* Create {@code key} using the {@code serializedValue}, previously obtained using {@link #dump(Object)}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value must not be {@literal null}.
|
||||
* @param timeToLive
|
||||
* @param unit must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/restore">Redis Documentation: RESTORE</a>
|
||||
*/
|
||||
void restore(K key, byte[] value, long timeToLive, TimeUnit unit);
|
||||
|
||||
/**
|
||||
* Get the time to live for {@code key} in seconds.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/ttl">Redis Documentation: TTL</a>
|
||||
*/
|
||||
Long getExpire(K key);
|
||||
|
||||
/**
|
||||
* Get the time to live for {@code key} in and convert it to the given {@link TimeUnit}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param timeUnit must not be {@literal null}.
|
||||
* @return
|
||||
* @since 1.8
|
||||
*/
|
||||
Long getExpire(K key, TimeUnit timeUnit);
|
||||
|
||||
void watch(K keys);
|
||||
/**
|
||||
* Sort the elements for {@code query}.
|
||||
*
|
||||
* @param query must not be {@literal null}.
|
||||
* @return the results of sort.
|
||||
* @see <a href="http://redis.io/commands/sort">Redis Documentation: SORT</a>
|
||||
*/
|
||||
List<V> sort(SortQuery<K> query);
|
||||
|
||||
/**
|
||||
* Sort the elements for {@code query} applying {@link RedisSerializer}.
|
||||
*
|
||||
* @param query must not be {@literal null}.
|
||||
* @return the deserialized results of sort.
|
||||
* @see <a href="http://redis.io/commands/sort">Redis Documentation: SORT</a>
|
||||
*/
|
||||
<T> List<T> sort(SortQuery<K> query, RedisSerializer<T> resultSerializer);
|
||||
|
||||
/**
|
||||
* Sort the elements for {@code query} applying {@link BulkMapper}.
|
||||
*
|
||||
* @param query must not be {@literal null}.
|
||||
* @return the deserialized results of sort.
|
||||
* @see <a href="http://redis.io/commands/sort">Redis Documentation: SORT</a>
|
||||
*/
|
||||
<T> List<T> sort(SortQuery<K> query, BulkMapper<T, V> bulkMapper);
|
||||
|
||||
/**
|
||||
* Sort the elements for {@code query} applying {@link BulkMapper} and {@link RedisSerializer}.
|
||||
*
|
||||
* @param query must not be {@literal null}.
|
||||
* @return the deserialized results of sort.
|
||||
* @see <a href="http://redis.io/commands/sort">Redis Documentation: SORT</a>
|
||||
*/
|
||||
<T, S> List<T> sort(SortQuery<K> query, BulkMapper<T, S> bulkMapper, RedisSerializer<S> resultSerializer);
|
||||
|
||||
/**
|
||||
* Sort the elements for {@code query} and store result in {@code storeKey}.
|
||||
*
|
||||
* @param query must not be {@literal null}.
|
||||
* @param storeKey must not be {@literal null}.
|
||||
* @return number of values.
|
||||
* @see <a href="http://redis.io/commands/sort">Redis Documentation: SORT</a>
|
||||
*/
|
||||
Long sort(SortQuery<K> query, K storeKey);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Methods dealing with Redis Transactions
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Watch given {@code key} for modifications during transaction started with {@link #multi()}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/watch">Redis Documentation: WATCH</a>
|
||||
*/
|
||||
void watch(K key);
|
||||
|
||||
/**
|
||||
* Watch given {@code keys} for modifications during transaction started with {@link #multi()}.
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/watch">Redis Documentation: WATCH</a>
|
||||
*/
|
||||
void watch(Collection<K> keys);
|
||||
|
||||
/**
|
||||
* Flushes all the previously {@link #watch(Object)} keys.
|
||||
*
|
||||
* @see <a href="http://redis.io/commands/unwatch">Redis Documentation: UNWATCH</a>
|
||||
*/
|
||||
void unwatch();
|
||||
|
||||
/**
|
||||
* '
|
||||
* Mark the start of a transaction block. <br>
|
||||
* Commands will be queued and can then be executed by calling {@link #exec()} or rolled back using {@link #discard()}
|
||||
* <p>
|
||||
*
|
||||
* @see <a href="http://redis.io/commands/multi">Redis Documentation: MULTI</a>
|
||||
*/
|
||||
void multi();
|
||||
|
||||
/**
|
||||
* Discard all commands issued after {@link #multi()}.
|
||||
*
|
||||
* @see <a href="http://redis.io/commands/discard">Redis Documentation: DISCARD</a>
|
||||
*/
|
||||
void discard();
|
||||
|
||||
/**
|
||||
* Executes all queued commands in a transaction started with {@link #multi()}. <br>
|
||||
* If used along with {@link #watch(Object)} the operation will fail if any of watched keys has been modified.
|
||||
*
|
||||
* @return List of replies for each executed command.
|
||||
* @see <a href="http://redis.io/commands/exec">Redis Documentation: EXEC</a>
|
||||
*/
|
||||
List<Object> exec();
|
||||
|
||||
/**
|
||||
* Execute a transaction, using the provided {@link RedisSerializer} to deserialize any results that are byte[]s or
|
||||
* Collections of byte[]s. If a result is a Map, the provided {@link RedisSerializer} will be used for both the keys
|
||||
* and values. Other result types (Long, Boolean, etc) are left as-is in the converted results. Tuple results are
|
||||
* automatically converted to TypedTuples.
|
||||
*
|
||||
* @param valueSerializer The {@link RedisSerializer} to use for deserializing the results of transaction exec
|
||||
* @return The deserialized results of transaction exec
|
||||
*/
|
||||
List<Object> exec(RedisSerializer<?> valueSerializer);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Methods dealing with Redis Server Commands
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* /** Request information and statistics about connected clients.
|
||||
*
|
||||
@@ -197,19 +417,46 @@ public interface RedisOperations<K, V> {
|
||||
List<RedisClientInfo> getClientList();
|
||||
|
||||
/**
|
||||
* Execute a transaction, using the provided {@link RedisSerializer} to deserialize any results that are byte[]s or
|
||||
* Collections of byte[]s. If a result is a Map, the provided {@link RedisSerializer} will be used for both the keys
|
||||
* and values. Other result types (Long, Boolean, etc) are left as-is in the converted results. Tuple results are
|
||||
* automatically converted to TypedTuples.
|
||||
*
|
||||
* @param valueSerializer The {@link RedisSerializer} to use for deserializing the results of transaction exec
|
||||
* @return The deserialized results of transaction exec
|
||||
* Closes a given client connection identified by {@literal ip:port} given in {@code client}.
|
||||
*
|
||||
* @param host of connection to close.
|
||||
* @param port of connection to close
|
||||
* @since 1.3
|
||||
*/
|
||||
List<Object> exec(RedisSerializer<?> valueSerializer);
|
||||
void killClient(String host, int port);
|
||||
|
||||
// pubsub functionality on the template
|
||||
/**
|
||||
* Change redis replication setting to new master.
|
||||
*
|
||||
* @param host must not be {@literal null}.
|
||||
* @param port
|
||||
* @since 1.3
|
||||
* @see <a href="http://redis.io/commands/slaveof">Redis Documentation: SLAVEOF</a>
|
||||
*/
|
||||
void slaveOf(String host, int port);
|
||||
|
||||
/**
|
||||
* Change server into master.
|
||||
*
|
||||
* @since 1.3
|
||||
* @see <a href="http://redis.io/commands/slaveof">Redis Documentation: SLAVEOF</a>
|
||||
*/
|
||||
void slaveOfNoOne();
|
||||
|
||||
/**
|
||||
* Publishes the given message to the given channel.
|
||||
*
|
||||
* @param destination the channel to publish to, must not be {@literal null}.
|
||||
* @param message message to publish
|
||||
* @return the number of clients that received the message
|
||||
* @see <a href="http://redis.io/commands/publish">Redis Documentation: PUBLISH</a>
|
||||
*/
|
||||
void convertAndSend(String destination, Object message);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Methods to obtain specific operations interface objects.
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
// operation types
|
||||
/**
|
||||
* Returns the operations performed on simple values (or Strings in Redis terminology).
|
||||
@@ -321,46 +568,24 @@ public interface RedisOperations<K, V> {
|
||||
*/
|
||||
ClusterOperations<K, V> opsForCluster();
|
||||
|
||||
List<V> sort(SortQuery<K> query);
|
||||
|
||||
<T> List<T> sort(SortQuery<K> query, RedisSerializer<T> resultSerializer);
|
||||
|
||||
<T> List<T> sort(SortQuery<K> query, BulkMapper<T, V> bulkMapper);
|
||||
|
||||
<T, S> List<T> sort(SortQuery<K> query, BulkMapper<T, S> bulkMapper, RedisSerializer<S> resultSerializer);
|
||||
|
||||
Long sort(SortQuery<K> query, K storeKey);
|
||||
|
||||
RedisSerializer<?> getValueSerializer();
|
||||
|
||||
/**
|
||||
* @return the key {@link RedisSerializer}.
|
||||
*/
|
||||
RedisSerializer<?> getKeySerializer();
|
||||
|
||||
/**
|
||||
* @return the value {@link RedisSerializer}.
|
||||
*/
|
||||
RedisSerializer<?> getValueSerializer();
|
||||
|
||||
/**
|
||||
* @return the hash key {@link RedisSerializer}.
|
||||
*/
|
||||
RedisSerializer<?> getHashKeySerializer();
|
||||
|
||||
/**
|
||||
* @return the hash value {@link RedisSerializer}.
|
||||
*/
|
||||
RedisSerializer<?> getHashValueSerializer();
|
||||
|
||||
/**
|
||||
* Closes a given client connection identified by {@literal ip:port} given in {@code client}.
|
||||
*
|
||||
* @param host of connection to close.
|
||||
* @param port of connection to close
|
||||
* @since 1.3
|
||||
*/
|
||||
void killClient(String host, int port);
|
||||
|
||||
/**
|
||||
* Change redis replication setting to new master.
|
||||
*
|
||||
* @param host
|
||||
* @param port
|
||||
* @since 1.3
|
||||
*/
|
||||
void slaveOf(String host, int port);
|
||||
|
||||
/**
|
||||
* Change server into master.
|
||||
*
|
||||
* @since 1.3
|
||||
*/
|
||||
void slaveOfNoOne();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2016 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.redis.core;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -25,63 +24,243 @@ import java.util.Set;
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface SetOperations<K, V> {
|
||||
|
||||
Set<V> difference(K key, K otherKey);
|
||||
|
||||
Set<V> difference(K key, Collection<K> otherKeys);
|
||||
|
||||
Long differenceAndStore(K key, K otherKey, K destKey);
|
||||
|
||||
Long differenceAndStore(K key, Collection<K> otherKeys, K destKey);
|
||||
|
||||
Set<V> intersect(K key, K otherKey);
|
||||
|
||||
Set<V> intersect(K key, Collection<K> otherKeys);
|
||||
|
||||
Long intersectAndStore(K key, K otherKey, K destKey);
|
||||
|
||||
Long intersectAndStore(K key, Collection<K> otherKeys, K destKey);
|
||||
|
||||
Set<V> union(K key, K otherKey);
|
||||
|
||||
Set<V> union(K key, Collection<K> otherKeys);
|
||||
|
||||
Long unionAndStore(K key, K otherKey, K destKey);
|
||||
|
||||
Long unionAndStore(K key, Collection<K> otherKeys, K destKey);
|
||||
|
||||
/**
|
||||
* Add given {@code values} to set at {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param values
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sadd">Redis Documentation: SADD</a>
|
||||
*/
|
||||
Long add(K key, V... values);
|
||||
|
||||
Boolean isMember(K key, Object o);
|
||||
|
||||
Set<V> members(K key);
|
||||
|
||||
Boolean move(K key, V value, K destKey);
|
||||
|
||||
V randomMember(K key);
|
||||
|
||||
Set<V> distinctRandomMembers(K key, long count);
|
||||
|
||||
List<V> randomMembers(K key, long count);
|
||||
|
||||
/**
|
||||
* Remove given {@code values} from set at {@code key} and return the number of removed elements.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param values
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/srem">Redis Documentation: SREM</a>
|
||||
*/
|
||||
Long remove(K key, Object... values);
|
||||
|
||||
/**
|
||||
* Remove and return a random member from set at {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/spop">Redis Documentation: SPOP</a>
|
||||
*/
|
||||
V pop(K key);
|
||||
|
||||
/**
|
||||
* Move {@code value} from {@code key} to {@code destKey}
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/smove">Redis Documentation: SMOVE</a>
|
||||
*/
|
||||
Boolean move(K key, V value, K destKey);
|
||||
|
||||
/**
|
||||
* Get size of set at {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/scard">Redis Documentation: SCARD</a>
|
||||
*/
|
||||
Long size(K key);
|
||||
|
||||
RedisOperations<K, V> getOperations();
|
||||
/**
|
||||
* Check if set at {@code key} contains {@code value}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param o
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sismember">Redis Documentation: SISMEMBER</a>
|
||||
*/
|
||||
Boolean isMember(K key, Object o);
|
||||
|
||||
/**
|
||||
* Returns the members intersecting all given sets at {@code key} and {@code otherKey}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param otherKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sinter">Redis Documentation: SINTER</a>
|
||||
*/
|
||||
Set<V> intersect(K key, K otherKey);
|
||||
|
||||
/**
|
||||
* Returns the members intersecting all given sets at {@code key} and {@code otherKeys}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param otherKeys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sinter">Redis Documentation: SINTER</a>
|
||||
*/
|
||||
Set<V> intersect(K key, Collection<K> otherKeys);
|
||||
|
||||
/**
|
||||
* Intersect all given sets at {@code key} and {@code otherKey} and store result in {@code destKey}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param otherKey must not be {@literal null}.
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sinterstore">Redis Documentation: SINTERSTORE</a>
|
||||
*/
|
||||
Long intersectAndStore(K key, K otherKey, K destKey);
|
||||
|
||||
/**
|
||||
* Intersect all given sets at {@code key} and {@code otherKeys} and store result in {@code destKey}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param otherKeys must not be {@literal null}.
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sinterstore">Redis Documentation: SINTERSTORE</a>
|
||||
*/
|
||||
Long intersectAndStore(K key, Collection<K> otherKeys, K destKey);
|
||||
|
||||
/**
|
||||
* Union all sets at given {@code keys} and {@code otherKey}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param otherKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sunion">Redis Documentation: SUNION</a>
|
||||
*/
|
||||
Set<V> union(K key, K otherKey);
|
||||
|
||||
/**
|
||||
* Union all sets at given {@code keys} and {@code otherKeys}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param otherKeys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sunion">Redis Documentation: SUNION</a>
|
||||
*/
|
||||
Set<V> union(K key, Collection<K> otherKeys);
|
||||
|
||||
/**
|
||||
* Union all sets at given {@code key} and {@code otherKey} and store result in {@code destKey}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param otherKey must not be {@literal null}.
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sunionstore">Redis Documentation: SUNIONSTORE</a>
|
||||
*/
|
||||
Long unionAndStore(K key, K otherKey, K destKey);
|
||||
|
||||
/**
|
||||
* Union all sets at given {@code key} and {@code otherKeys} and store result in {@code destKey}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param otherKeys must not be {@literal null}.
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sunionstore">Redis Documentation: SUNIONSTORE</a>
|
||||
*/
|
||||
Long unionAndStore(K key, Collection<K> otherKeys, K destKey);
|
||||
|
||||
/**
|
||||
* Diff all sets for given {@code key} and {@code otherKey}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param otherKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sdiff">Redis Documentation: SDIFF</a>
|
||||
*/
|
||||
Set<V> difference(K key, K otherKey);
|
||||
|
||||
/**
|
||||
* Diff all sets for given {@code key} and {@code otherKeys}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param otherKeys must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sdiff">Redis Documentation: SDIFF</a>
|
||||
*/
|
||||
Set<V> difference(K key, Collection<K> otherKeys);
|
||||
|
||||
/**
|
||||
* Diff all sets for given {@code key} and {@code otherKey} and store result in {@code destKey}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param otherKey must not be {@literal null}.
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sdiffstore">Redis Documentation: SDIFFSTORE</a>
|
||||
*/
|
||||
Long differenceAndStore(K key, K otherKey, K destKey);
|
||||
|
||||
/**
|
||||
* Diff all sets for given {@code key} and {@code otherKeys} and store result in {@code destKey}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param otherKeys must not be {@literal null}.
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/sdiffstore">Redis Documentation: SDIFFSTORE</a>
|
||||
*/
|
||||
Long differenceAndStore(K key, Collection<K> otherKeys, K destKey);
|
||||
|
||||
/**
|
||||
* Get all elements of set at {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/smembers">Redis Documentation: SMEMBERS</a>
|
||||
*/
|
||||
Set<V> members(K key);
|
||||
|
||||
/**
|
||||
* Get random element from set at {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/srandmember">Redis Documentation: SRANDMEMBER</a>
|
||||
*/
|
||||
V randomMember(K key);
|
||||
|
||||
/**
|
||||
* Get {@code count} distinct random elements from set at {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param count
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/srandmember">Redis Documentation: SRANDMEMBER</a>
|
||||
*/
|
||||
Set<V> distinctRandomMembers(K key, long count);
|
||||
|
||||
/**
|
||||
* Get {@code count} random elements from set at {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param count
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/srandmember">Redis Documentation: SRANDMEMBER</a>
|
||||
*/
|
||||
List<V> randomMembers(K key, long count);
|
||||
|
||||
/**
|
||||
* Iterate over elements in set at {@code key}. <br />
|
||||
* <strong>Important:</strong> Call {@link Cursor#close()} when done to avoid resource leak.
|
||||
*
|
||||
* @since 1.4
|
||||
* @param key
|
||||
* @param options
|
||||
* @return
|
||||
* @since 1.4
|
||||
*/
|
||||
Cursor<V> scan(K key, ScanOptions options);
|
||||
|
||||
RedisOperations<K, V> getOperations();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2014 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,63 +25,156 @@ import java.util.concurrent.TimeUnit;
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public interface ValueOperations<K, V> {
|
||||
|
||||
/**
|
||||
* Set {@code value} for {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value
|
||||
* @see <a href="http://redis.io/commands/set">Redis Documentation: SET</a>
|
||||
*/
|
||||
void set(K key, V value);
|
||||
|
||||
/**
|
||||
* Set {@code key} to hold the string {@code value} until {@code timeout}.
|
||||
*
|
||||
* @param key
|
||||
* Set the {@code value} and expiration {@code timeout} for {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value
|
||||
* @param timeout
|
||||
* @param units
|
||||
* @see http://redis.io/commands/set
|
||||
* @param unit must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/setex">Redis Documentation: SETEX</a>
|
||||
*/
|
||||
void set(K key, V value, long timeout, TimeUnit unit);
|
||||
|
||||
/**
|
||||
* Set {@code key} to hold the string {@code value} if {@code key} is absent.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value
|
||||
* @see <a href="http://redis.io/commands/setnx">Redis Documentation: SETNX</a>
|
||||
*/
|
||||
Boolean setIfAbsent(K key, V value);
|
||||
|
||||
void multiSet(Map<? extends K, ? extends V> m);
|
||||
/**
|
||||
* Set multiple keys to multiple values using key-value pairs provided in {@code tuple}.
|
||||
*
|
||||
* @param map must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/mset">Redis Documentation: MSET</a>
|
||||
*/
|
||||
void multiSet(Map<? extends K, ? extends V> map);
|
||||
|
||||
Boolean multiSetIfAbsent(Map<? extends K, ? extends V> m);
|
||||
/**
|
||||
* Set multiple keys to multiple values using key-value pairs provided in {@code tuple} only if the provided key does
|
||||
* not exist.
|
||||
*
|
||||
* @param map must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/mset">Redis Documentation: MSET</a>
|
||||
*/
|
||||
Boolean multiSetIfAbsent(Map<? extends K, ? extends V> map);
|
||||
|
||||
/**
|
||||
* Get the value of {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/get">Redis Documentation: GET</a>
|
||||
*/
|
||||
V get(Object key);
|
||||
|
||||
/**
|
||||
* Set {@code value} of {@code key} and return its old value.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/getset">Redis Documentation: GETSET</a>
|
||||
*/
|
||||
V getAndSet(K key, V value);
|
||||
|
||||
/**
|
||||
* Get multiple {@code keys}. Values are returned in the order of the requested keys.
|
||||
*
|
||||
* @param keys must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/mget">Redis Documentation: MGET</a>
|
||||
*/
|
||||
List<V> multiGet(Collection<K> keys);
|
||||
|
||||
/**
|
||||
* Increment an integer value stored as string value under {@code key} by {@code delta}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param delta
|
||||
* @see <a href="http://redis.io/commands/incr">Redis Documentation: INCR</a>
|
||||
*/
|
||||
Long increment(K key, long delta);
|
||||
|
||||
/**
|
||||
* Increment a floating point number value stored as string value under {@code key} by {@code delta}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param delta
|
||||
* @see <a href="http://redis.io/commands/incrbyfloar">Redis Documentation: INCRBYFLOAT</a>
|
||||
*/
|
||||
Double increment(K key, double delta);
|
||||
|
||||
/**
|
||||
* Append a {@code value} to {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value
|
||||
* @see <a href="http://redis.io/commands/append">Redis Documentation: APPEND</a>
|
||||
*/
|
||||
Integer append(K key, String value);
|
||||
|
||||
/**
|
||||
* Get a substring of value of {@code key} between {@code begin} and {@code end}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param start
|
||||
* @param end
|
||||
* @see <a href="http://redis.io/commands/getrange">Redis Documentation: GETRANGE</a>
|
||||
*/
|
||||
String get(K key, long start, long end);
|
||||
|
||||
/**
|
||||
* Overwrite parts of {@code key} starting at the specified {@code offset} with given {@code value}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param value
|
||||
* @param offset
|
||||
* @see <a href="http://redis.io/commands/setrange">Redis Documentation: SETRANGE</a>
|
||||
*/
|
||||
void set(K key, V value, long offset);
|
||||
|
||||
/**
|
||||
* Get the length of the value stored at {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @see <a href="http://redis.io/commands/strlen">Redis Documentation: STRLEN</a>
|
||||
*/
|
||||
Long size(K key);
|
||||
|
||||
RedisOperations<K, V> getOperations();
|
||||
|
||||
/**
|
||||
* @since 1.5
|
||||
* @param key
|
||||
* Sets the bit at {@code offset} in value stored at {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param offset
|
||||
* @param value
|
||||
* @return
|
||||
* @since 1.5
|
||||
* @see <a href="http://redis.io/commands/setbit">Redis Documentation: SETBIT</a>
|
||||
*/
|
||||
Boolean setBit(K key, long offset, boolean value);
|
||||
|
||||
|
||||
/**
|
||||
* @since 1.5
|
||||
* @param key
|
||||
* Get the bit value at {@code offset} of value at {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param offset
|
||||
* @return
|
||||
* @since 1.5
|
||||
* @see <a href="http://redis.io/commands/setbit">Redis Documentation: GETBIT</a>
|
||||
*/
|
||||
Boolean getBit(K key, long offset);
|
||||
|
||||
|
||||
RedisOperations<K, V> getOperations();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2016 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.redis.core;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -21,6 +20,7 @@ import java.util.Set;
|
||||
|
||||
import org.springframework.data.redis.connection.RedisZSetCommands.Limit;
|
||||
import org.springframework.data.redis.connection.RedisZSetCommands.Range;
|
||||
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple;
|
||||
|
||||
/**
|
||||
* Redis ZSet/sorted set specific operations.
|
||||
@@ -40,29 +40,339 @@ public interface ZSetOperations<K, V> {
|
||||
Double getScore();
|
||||
}
|
||||
|
||||
Long intersectAndStore(K key, K otherKey, K destKey);
|
||||
/**
|
||||
* Add {@code value} to a sorted set at {@code key}, or update its {@code score} if it already exists.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param score the score.
|
||||
* @param value the value.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zadd">Redis Documentation: ZADD</a>
|
||||
*/
|
||||
Boolean add(K key, V value, double score);
|
||||
|
||||
Long intersectAndStore(K key, Collection<K> otherKeys, K destKey);
|
||||
/**
|
||||
* Add {@code tuples} to a sorted set at {@code key}, or update its {@code score} if it already exists.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param tuples must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zadd">Redis Documentation: ZADD</a>
|
||||
*/
|
||||
Long add(K key, Set<TypedTuple<V>> tuples);
|
||||
|
||||
Long unionAndStore(K key, K otherKey, K destKey);
|
||||
/**
|
||||
* Remove {@code values} from sorted set. Return number of removed elements.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param values must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrem">Redis Documentation: ZREM</a>
|
||||
*/
|
||||
Long remove(K key, Object... values);
|
||||
|
||||
Long unionAndStore(K key, Collection<K> otherKeys, K destKey);
|
||||
/**
|
||||
* Increment the score of element with {@code value} in sorted set by {@code increment}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param delta
|
||||
* @param value the value.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zincrby">Redis Documentation: ZINCRBY</a>
|
||||
*/
|
||||
Double incrementScore(K key, V value, double delta);
|
||||
|
||||
/**
|
||||
* Determine the index of element with {@code value} in a sorted set.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param o the value.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrank">Redis Documentation: ZRANK</a>
|
||||
*/
|
||||
Long rank(K key, Object o);
|
||||
|
||||
/**
|
||||
* Determine the index of element with {@code value} in a sorted set when scored high to low.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param o the value.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrank">Redis Documentation: ZREVRANK</a>
|
||||
*/
|
||||
Long reverseRank(K key, Object o);
|
||||
|
||||
/**
|
||||
* Get elements between {@code start} and {@code end} from sorted set.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrange">Redis Documentation: ZRANGE</a>
|
||||
*/
|
||||
Set<V> range(K key, long start, long end);
|
||||
|
||||
Set<V> reverseRange(K key, long start, long end);
|
||||
|
||||
/**
|
||||
* Get set of {@link Tuple}s between {@code start} and {@code end} from sorted set.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrange">Redis Documentation: ZRANGE</a>
|
||||
*/
|
||||
Set<TypedTuple<V>> rangeWithScores(K key, long start, long end);
|
||||
|
||||
/**
|
||||
* Get elements where score is between {@code min} and {@code max} from sorted set.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param min
|
||||
* @param max
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<V> rangeByScore(K key, double min, double max);
|
||||
|
||||
/**
|
||||
* Get set of {@link Tuple}s where score is between {@code min} and {@code max} from sorted set.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param min
|
||||
* @param max
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<TypedTuple<V>> rangeByScoreWithScores(K key, double min, double max);
|
||||
|
||||
/**
|
||||
* Get elements in range from {@code start} to {@code end} where score is between {@code min} and {@code max} from
|
||||
* sorted set.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param min
|
||||
* @param max
|
||||
* @param offset
|
||||
* @param count
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<V> rangeByScore(K key, double min, double max, long offset, long count);
|
||||
|
||||
/**
|
||||
* Get set of {@link Tuple}s in range from {@code start} to {@code end} where score is between {@code min} and
|
||||
* {@code max} from sorted set.
|
||||
*
|
||||
* @param key
|
||||
* @param min
|
||||
* @param max
|
||||
* @param offset
|
||||
* @param count
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<TypedTuple<V>> rangeByScoreWithScores(K key, double min, double max, long offset, long count);
|
||||
|
||||
/**
|
||||
* Get elements in range from {@code start} to {@code end} from sorted set ordered from high to low.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrange">Redis Documentation: ZREVRANGE</a>
|
||||
*/
|
||||
Set<V> reverseRange(K key, long start, long end);
|
||||
|
||||
/**
|
||||
* Get set of {@link Tuple}s in range from {@code start} to {@code end} from sorted set ordered from high to low.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrange">Redis Documentation: ZREVRANGE</a>
|
||||
*/
|
||||
Set<TypedTuple<V>> reverseRangeWithScores(K key, long start, long end);
|
||||
|
||||
/**
|
||||
* Get elements where score is between {@code min} and {@code max} from sorted set ordered from high to low.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param min
|
||||
* @param max
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrange">Redis Documentation: ZREVRANGE</a>
|
||||
*/
|
||||
Set<V> reverseRangeByScore(K key, double min, double max);
|
||||
|
||||
/**
|
||||
* Get set of {@link Tuple} where score is between {@code min} and {@code max} from sorted set ordered from high to
|
||||
* low.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param min
|
||||
* @param max
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrangebyscore">Redis Documentation: ZREVRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<TypedTuple<V>> reverseRangeByScoreWithScores(K key, double min, double max);
|
||||
|
||||
/**
|
||||
* Get elements in range from {@code start} to {@code end} where score is between {@code min} and {@code max} from
|
||||
* sorted set ordered high -> low.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param min
|
||||
* @param max
|
||||
* @param offset
|
||||
* @param count
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrangebyscore">Redis Documentation: ZREVRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<V> reverseRangeByScore(K key, double min, double max, long offset, long count);
|
||||
|
||||
/**
|
||||
* Get set of {@link Tuple} in range from {@code start} to {@code end} where score is between {@code min} and
|
||||
* {@code max} from sorted set ordered high -> low.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param min
|
||||
* @param max
|
||||
* @param offset
|
||||
* @param count
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrevrangebyscore">Redis Documentation: ZREVRANGEBYSCORE</a>
|
||||
*/
|
||||
Set<TypedTuple<V>> reverseRangeByScoreWithScores(K key, double min, double max, long offset, long count);
|
||||
|
||||
/**
|
||||
* Count number of elements within sorted set with scores between {@code min} and {@code max}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param min
|
||||
* @param max
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zcount">Redis Documentation: ZCOUNT</a>
|
||||
*/
|
||||
Long count(K key, double min, double max);
|
||||
|
||||
/**
|
||||
* Returns the number of elements of the sorted set stored with given {@code key}.
|
||||
*
|
||||
* @see #zCard(Object)
|
||||
* @param key
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zcard">Redis Documentation: ZCARD</a>
|
||||
*/
|
||||
Long size(K key);
|
||||
|
||||
/**
|
||||
* Get the size of sorted set with {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @return
|
||||
* @since 1.3
|
||||
* @see <a href="http://redis.io/commands/zcard">Redis Documentation: ZCARD</a>
|
||||
*/
|
||||
Long zCard(K key);
|
||||
|
||||
/**
|
||||
* Get the score of element with {@code value} from sorted set with key {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param o the value.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zrem">Redis Documentation: ZREM</a>
|
||||
*/
|
||||
Double score(K key, Object o);
|
||||
|
||||
/**
|
||||
* Remove elements in range between {@code start} and {@code end} from sorted set with {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zremrangebyrank">Redis Documentation: ZREMRANGEBYRANK</a>
|
||||
*/
|
||||
Long removeRange(K key, long start, long end);
|
||||
|
||||
/**
|
||||
* Remove elements with scores between {@code min} and {@code max} from sorted set with {@code key}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param min
|
||||
* @param max
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zremrangebyscore">Redis Documentation: ZREMRANGEBYSCORE</a>
|
||||
*/
|
||||
Long removeRangeByScore(K key, double min, double max);
|
||||
|
||||
/**
|
||||
* Union sorted sets at {@code key} and {@code otherKeys} and store result in destination {@code destKey}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param otherKey must not be {@literal null}.
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zunionstore">Redis Documentation: ZUNIONSTORE</a>
|
||||
*/
|
||||
Long unionAndStore(K key, K otherKey, K destKey);
|
||||
|
||||
/**
|
||||
* Union sorted sets at {@code key} and {@code otherKeys} and store result in destination {@code destKey}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param otherKeys must not be {@literal null}.
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zunionstore">Redis Documentation: ZUNIONSTORE</a>
|
||||
*/
|
||||
Long unionAndStore(K key, Collection<K> otherKeys, K destKey);
|
||||
|
||||
/**
|
||||
* Intersect sorted sets at {@code key} and {@code otherKey} and store result in destination {@code destKey}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param otherKey must not be {@literal null}.
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zinterstore">Redis Documentation: ZINTERSTORE</a>
|
||||
*/
|
||||
Long intersectAndStore(K key, K otherKey, K destKey);
|
||||
|
||||
/**
|
||||
* Intersect sorted sets at {@code key} and {@code otherKeys} and store result in destination {@code destKey}.
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param otherKeys must not be {@literal null}.
|
||||
* @param destKey must not be {@literal null}.
|
||||
* @return
|
||||
* @see <a href="http://redis.io/commands/zinterstore">Redis Documentation: ZINTERSTORE</a>
|
||||
*/
|
||||
Long intersectAndStore(K key, Collection<K> otherKeys, K destKey);
|
||||
|
||||
/**
|
||||
* Iterate over elements in zset at {@code key}. <br />
|
||||
* <strong>Important:</strong> Call {@link Cursor#close()} when done to avoid resource leak.
|
||||
*
|
||||
* @param key
|
||||
* @param options
|
||||
* @return
|
||||
* @since 1.4
|
||||
*/
|
||||
Cursor<TypedTuple<V>> scan(K key, ScanOptions options);
|
||||
|
||||
/**
|
||||
* Get all elements with lexicographical ordering from {@literal ZSET} at {@code key} with a value between
|
||||
* {@link Range#getMin()} and {@link Range#getMax()}.
|
||||
*
|
||||
*
|
||||
* @param key must not be {@literal null}.
|
||||
* @param range must not be {@literal null}.
|
||||
* @since 1.7
|
||||
* @see <a href="http://redis.io/commands/zrangebylex">Redis Documentation: ZRANGEBYLEX</a>
|
||||
*/
|
||||
Set<V> rangeByLex(K key, Range range);
|
||||
|
||||
@@ -70,79 +380,15 @@ public interface ZSetOperations<K, V> {
|
||||
* Get all elements {@literal n} elements, where {@literal n = } {@link Limit#getCount()}, starting at
|
||||
* {@link Limit#getOffset()} with lexicographical ordering from {@literal ZSET} at {@code key} with a value between
|
||||
* {@link Range#getMin()} and {@link Range#getMax()}.
|
||||
*
|
||||
*
|
||||
* @param key must not be {@literal null}
|
||||
* @param range must not be {@literal null}.
|
||||
* @param limit can be {@literal null}.
|
||||
* @return
|
||||
* @since 1.7
|
||||
* @see <a href="http://redis.io/commands/zrangebylex">Redis Documentation: ZRANGEBYLEX</a>
|
||||
*/
|
||||
Set<V> rangeByLex(K key, Range range, Limit limit);
|
||||
|
||||
Set<V> rangeByScore(K key, double min, double max);
|
||||
|
||||
Set<V> rangeByScore(K key, double min, double max, long offset, long count);
|
||||
|
||||
Set<V> reverseRangeByScore(K key, double min, double max);
|
||||
|
||||
Set<V> reverseRangeByScore(K key, double min, double max, long offset, long count);
|
||||
|
||||
Set<TypedTuple<V>> rangeByScoreWithScores(K key, double min, double max);
|
||||
|
||||
Set<TypedTuple<V>> rangeByScoreWithScores(K key, double min, double max, long offset, long count);
|
||||
|
||||
Set<TypedTuple<V>> reverseRangeByScoreWithScores(K key, double min, double max);
|
||||
|
||||
Set<TypedTuple<V>> reverseRangeByScoreWithScores(K key, double min, double max, long offset, long count);
|
||||
|
||||
Boolean add(K key, V value, double score);
|
||||
|
||||
Long add(K key, Set<TypedTuple<V>> tuples);
|
||||
|
||||
Double incrementScore(K key, V value, double delta);
|
||||
|
||||
Long rank(K key, Object o);
|
||||
|
||||
Long reverseRank(K key, Object o);
|
||||
|
||||
Double score(K key, Object o);
|
||||
|
||||
Long remove(K key, Object... values);
|
||||
|
||||
Long removeRange(K key, long start, long end);
|
||||
|
||||
Long removeRangeByScore(K key, double min, double max);
|
||||
|
||||
Long count(K key, double min, double max);
|
||||
|
||||
/**
|
||||
* Returns the number of elements of the sorted set stored with given {@code key}.
|
||||
*
|
||||
* @see #zCard(Object)
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
Long size(K key);
|
||||
|
||||
/**
|
||||
* Returns the number of elements of the sorted set stored with given {@code key}.
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
* @since 1.3
|
||||
*/
|
||||
Long zCard(K key);
|
||||
|
||||
RedisOperations<K, V> getOperations();
|
||||
|
||||
/**
|
||||
* Iterate over elements in zset at {@code key}. <br />
|
||||
* <strong>Important:</strong> Call {@link Cursor#close()} when done to avoid resource leak.
|
||||
*
|
||||
* @since 1.4
|
||||
* @param key
|
||||
* @param options
|
||||
* @return
|
||||
*/
|
||||
Cursor<TypedTuple<V>> scan(K key, ScanOptions options);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user