Interface RedisConnectionCommands
- 
- All Known Implementing Classes:
 RedisConnection
public interface RedisConnectionCommandsInterface for Redis connection commands.- Author:
 - Matthew Tropiano
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static longTTL_NO_EXPIRETTL error - no expire.static longTTL_NOT_EXISTTTL error - not exist. 
- 
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longappend(String key, String value)longbitcount(String key)longbitcount(String key, long start, long end)longbitop(BitwiseOperation operation, String destkey, String key, String... keys)longbitpos(String key, long bit)longbitpos(String key, long bit, Long start, Long end)KeyValue<String,String>blpop(long timeout, String key, String... keys)KeyValue<String,String>brpop(long timeout, String key, String... keys)Stringbrpoplpush(long timeout, String source, String destination)StringclientGetName()booleanclientSetName(String name)longdecr(String key)longdecrby(String key, long decrement)longdel(String key, String... keys)Stringdump(String key)Stringecho(String message)RedisObjecteval(String scriptContent, String[] keys, Object... args)RedisObjectevalsha(String hash, String[] keys, Object... args)booleanexists(String key)booleanexpire(String key, long seconds)booleanexpireat(String key, long timestamp)Stringget(String key)longgetbit(String key, long offset)Stringgetrange(String key, long start, long end)Stringgetset(String key, Number value)Stringgetset(String key, String value)longhdel(String key, String field, String... fields)booleanhexists(String key, String field)Stringhget(String key, String field)String[]hgetall(String key)longhincrby(String key, String field, long increment)doublehincrbyfloat(String key, String field, double increment)String[]hkeys(String key)longhlen(String key)String[]hmget(String key, String field, String... fields)booleanhmset(String key, KeyValue<String,Object>... pairs)booleanhmset(String key, String field, String value, String... fieldvalues)booleanhset(String key, String field, Number value)booleanhset(String key, String field, String value)booleanhsetnx(String key, String field, Number value)booleanhsetnx(String key, String field, String value)String[]hvals(String key)longincr(String key)longincrby(String key, long increment)doubleincrbyfloat(String key, double increment)String[]keys(String pattern)Stringlindex(String key, long index)longlinsert(String key, boolean before, String pivot, Number value)longlinsert(String key, boolean before, String pivot, String value)longllen(String key)Stringlpop(String key)longlpush(String key, String value, String... values)longlpushx(String key, String value)String[]lrange(String key, long start, long stop)longlrem(String key, long count, String value)booleanlset(String key, long index, String value)booleanltrim(String key, long start, long stop)String[]mget(String key, String... keys)booleanmove(String key, long db)booleanmset(KeyValue<String,Object>... pairs)Likemset(String, String, String...), but takes key-value pairs.booleanmset(String key, String value, String... keyValues)booleanmsetnx(KeyValue<String,Object>... pairs)Likemsetnx(String, String, String...), but takes key-value pairs.booleanmsetnx(String key, String value, String... keyValues)booleanpersist(String key)booleanpexpire(String key, long milliseconds)booleanpexpireat(String key, long timestamp)longping()booleanpsetex(String key, long milliseconds, String value)longpttl(String key)longpublish(String channel, String message)booleanquit()Stringrandomkey()booleanrename(String key, String newkey)booleanrenamenx(String key, String newkey)booleanrestore(String key, long ttl, String serializedvalue)Stringrpop(String key)Stringrpoplpush(String source, String destination)longrpush(String key, String value, String... values)longrpushx(String key, String value)longsadd(String key, Object member, Object... members)longsadd(String key, String member, String... members)longscard(String key)boolean[]scriptExists(String scriptHash, String... scriptHashes)booleanscriptFlush()booleanscriptKill(String hash)StringscriptLoad(File content)StringscriptLoad(InputStream content)StringscriptLoad(String content)String[]sdiff(String key, String... keys)longsdiffstore(String destination, String key, String... keys)booleanset(String key, Number value)booleanset(String key, String value)longsetbit(String key, long offset, long value)booleansetex(String key, long seconds, String value)booleansetnx(String key, String value)longsetrange(String key, long offset, String value)String[]sinter(String key, String... keys)longsinterstore(String destination, String key, String... keys)booleansismember(String key, Number member)booleansismember(String key, String member)String[]smembers(String key)booleansmove(String source, String destination, String member)String[]sort(String key, String pattern, SortOrder sortOrder, boolean alpha, Long limitOffset, Long limitCount, String storeKey, String... getPatterns)Stringspop(String key)Stringsrandmember(String key)String[]srandmember(String key, long count)longsrem(String key, Object member, Object... members)longsrem(String key, String member, String... members)longstrlen(String key)String[]sunion(String key, String... keys)longsunionstore(String destination, String key, String... keys)longttl(String key)DataTypetype(String key)longzadd(String key, double score, Number member)longzadd(String key, double score, String member)longzadd(String key, KeyValue<Double,String>... pairs)longzcard(String key)longzcount(String key, double min, double max)Likezcount(String, String, String), except it accepts doubles for min and max, not strings.longzcount(String key, String min, String max)doublezincrby(String key, double increment, String member)longzinterstore(String destination, double[] weights, Aggregation aggregation, String key, String... keys)longzinterstore(String destination, double[] weights, String key, String... keys)Likezinterstore(String, double[], Aggregation, String, String...), except it does no aggregation of scores.longzinterstore(String destination, Aggregation aggregation, String key, String... keys)Likezinterstore(String, double[], Aggregation, String, String...), except no weights are applied to the source value scores.longzinterstore(String destination, String key, String... keys)Likezinterstore(String, double[], Aggregation, String, String...), except no weights are applied to the source value scores, and does no aggregation of scores.longzlexcount(String key, double min, double max)Likezlexcount(String, String, String), except it accepts doubles for min and max, not strings.longzlexcount(String key, String min, String max)String[]zrange(String key, long start, long stop, boolean withScores)longzrangebylex(String key, double min, double max)Likezrangebylex(String, String, String), except it accepts doubles for min and max, not strings, with no limit.longzrangebylex(String key, double min, double max, Long limitOffset, Long limitCount)Likezrangebylex(String, String, String, Long, Long), except it accepts doubles for min and max, not strings.longzrangebylex(String key, String min, String max)Likezrangebylex(String, String, String, Long, Long), with no limit.longzrangebylex(String key, String min, String max, Long limitOffset, Long limitCount)String[]zrangebyscore(String key, double min, double max, boolean withScores)Likezrangebyscore(String, String, String, boolean), except it accepts doubles for min and max, not strings.String[]zrangebyscore(String key, double min, double max, boolean withScores, Long limitOffset, Long limitCount)Likezrangebyscore(String, String, String, boolean, Long, Long), except it accepts doubles for min and max, not strings.String[]zrangebyscore(String key, String min, String max, boolean withScores)Likezrangebyscore(String, String, String, boolean, Long, Long), except specifies no limit.String[]zrangebyscore(String key, String min, String max, boolean withScores, Long limitOffset, Long limitCount)Longzrank(String key, Number member)Longzrank(String key, String member)longzrem(String key, Number member, Number... members)longzrem(String key, String member, String... members)longzremrangebylex(String key, double min, double max)Likezrangebylex(String, String, String), except it accepts doubles for min and max.longzremrangebylex(String key, String min, String max)longzremrangebyrank(String key, long start, long stop)longzremrangebyscore(String key, double min, double max)Likezremrangebyscore(String, String, String), except it accepts doubles for min and max, not strings.longzremrangebyscore(String key, String min, String max)String[]zrevrange(String key, long start, long stop, boolean withScores)String[]zrevrangebyscore(String key, double min, double max, boolean withScores)Likezrevrangebyscore(String, String, String, boolean), except it accepts doubles for min and max, not strings.String[]zrevrangebyscore(String key, double min, double max, boolean withScores, Long limitOffset, Long limitCount)Likezrevrangebyscore(String, String, String, boolean, Long, Long), except it accepts doubles for min and max, not strings.String[]zrevrangebyscore(String key, String min, String max, boolean withScores)Likezrevrangebyscore(String, String, String, boolean, Long, Long), except specifies no limit.String[]zrevrangebyscore(String key, String min, String max, boolean withScores, Long limitOffset, Long limitCount)Longzrevrank(String key, String member)Doublezscore(String key, String member)longzunionstore(String destination, double[] weights, Aggregation aggregation, String key, String... keys)longzunionstore(String destination, double[] weights, String key, String... keys)Likezunionstore(String, double[], Aggregation, String, String...), except it does no aggregation of scores.longzunionstore(String destination, Aggregation aggregation, String key, String... keys)Likezunionstore(String, double[], Aggregation, String, String...), except no weights are applied to the source value scores.longzunionstore(String destination, String key, String... keys)Likezunionstore(String, double[], Aggregation, String, String...), except no weights are applied to the source value scores, and does no aggregation of scores. 
 - 
 
- 
- 
Field Detail
- 
TTL_NO_EXPIRE
static final long TTL_NO_EXPIRE
TTL error - no expire.- See Also:
 - Constant Field Values
 
 
- 
TTL_NOT_EXIST
static final long TTL_NOT_EXIST
TTL error - not exist.- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
ping
long ping()
From http://redis.io/commands/ping:
Available since 1.0.0.
This command is often used to test if a connection is still alive, or to measure latency.
- Returns:
 - milliseconds between the call and the response. Ordinarily, Redis just returns "PONG", which is not very useful API-wise.
 
 
- 
quit
boolean quit()
From http://redis.io/commands/quit:
Available since 1.0.0.
Ask the server to close the connection. The connection is closed as soon as all pending replies have been written to the client.
- Returns:
 - always true.
 
 
- 
clientGetName
String clientGetName()
From http://redis.io/commands/client-getname:
Available since 2.6.9.
Time complexity: O(1)
The
CLIENT GETNAMEreturns the name of the current connection as set byCLIENT SETNAME. Since every new connection starts without an associated name, if no name was assigned a null bulk reply is returned.- Returns:
 - the connection name, or null if no name is set.
 
 
- 
clientSetName
boolean clientSetName(String name)
From http://redis.io/commands/client-setname:
Available since 2.6.9.
Time complexity: O(1)
The
CLIENT SETNAMEcommand assigns a name to the current connection.- Returns:
 - true if successful, false otherwise.
 
 
- 
del
long del(String key, String... keys)
From http://redis.io/commands/del:
Available since 1.0.0.
Time complexity: O(N) where N is the number of keys that will be removed. When a key to remove holds a value other than a string, the individual complexity for this key is O(M) where M is the number of elements in the list, set, sorted set or hash. Removing a single key that holds a string value is O(1).
Removes the specified keys. A key is ignored if it does not exist.
- Parameters:
 key- the first key to delete.keys- the additional keys to delete.- Returns:
 - The number of keys that were removed.
 
 
- 
dump
String dump(String key)
From http://redis.io/commands/dump:
Available since 2.6.0.
Time complexity: O(1) to access the key and additional O(N*M) to serialized it, where N is the number of Redis objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1*M) where M is small, so simply O(1).
Serialize the value stored at key in a Redis-specific format and return it to the user. The returned value can be synthesized back into a Redis key using the
restore(java.lang.String, long, java.lang.String)command.- Returns:
 - the serialized value.
 
 
- 
exists
boolean exists(String key)
From http://redis.io/commands/exists:
Available since 1.0.0.
Time complexity: O(1)
Returns if
keyexists.- Returns:
 - true if the key exists, false if not.
 
 
- 
expire
boolean expire(String key, long seconds)
From http://redis.io/commands/expire:
Available since 1.0.0.
Time complexity: O(1)
Set a timeout on
key. After the timeout has expired, the key will automatically be deleted. A key with an associated timeout is often said to be volatile in Redis terminology.- Parameters:
 key- the key to expire.seconds- the time-to-live in seconds.- Returns:
 - true if set, false if not set.
 
 
- 
expireat
boolean expireat(String key, long timestamp)
From http://redis.io/commands/expireat:
Available since 1.2.0.
Time complexity: O(1)
expireat has the same effect and semantic as
expire(java.lang.String, long), but instead of specifying the number of seconds representing the TTL (time to live), it takes an absolute Unix timestamp (seconds since January 1, 1970).- Parameters:
 key- the key to expire.timestamp- the timestamp in from-Epoch milliseconds.- Returns:
 - true if set, false if not set.
 
 
- 
keys
String[] keys(String pattern)
From http://redis.io/commands/keys:
Available since 1.0.0.
Time complexity: O(N) with N being the number of keys in the database, under the assumption that the key names in the database and the given pattern have limited length.
Returns all keys matching
pattern.- Parameters:
 pattern- a wildcard pattern for matching key names.- Returns:
 - a list of keys matching 
pattern. 
 
- 
move
boolean move(String key, long db)
From http://redis.io/commands/move:
Available since 1.0.0.
Time complexity: O(1)
Move
keyfrom the currently selected database to the specified destination database. Whenkeyalready exists in the destination database, or it does not exist in the source database, it does nothing. It is possible to use MOVE as a locking primitive because of this.- Parameters:
 key- the key to move.db- the target database.- Returns:
 - true if the key was moved, false if not.
 
 
- 
persist
boolean persist(String key)
From http://redis.io/commands/persist:
Available since 2.2.0.
Time complexity: O(1)
Remove the existing timeout on
key, turning the key from volatile (a key with an expire set) to persistent (a key that will never expire as no timeout is associated).- Parameters:
 key- the key to persist (remove TTL).- Returns:
 - true if successful, false if not.
 
 
- 
pexpire
boolean pexpire(String key, long milliseconds)
From http://redis.io/commands/pexpire:
Available since 2.6.0.
Time complexity: O(1)
This command works exactly like
expire(java.lang.String, long)but the time to live of the key is specified in milliseconds instead of seconds.- Parameters:
 key- the key to expire.milliseconds- the time-to-live in milliseconds.- Returns:
 - true if successful, false if not.
 
 
- 
pexpireat
boolean pexpireat(String key, long timestamp)
From http://redis.io/commands/pexpireat:
Available since 2.6.0.
Time complexity: O(1)
PEXPIREAT has the same effect and semantic as
expireat(java.lang.String, long), but the Unix time at which the key will expire is specified in milliseconds instead of seconds.- Parameters:
 key- the key to expire.timestamp- the timestamp in from-Epoch milliseconds.- Returns:
 - true if successful, false if not.
 
 
- 
pttl
long pttl(String key)
From http://redis.io/commands/pttl:
Available since 2.6.0.
Time complexity: O(1)
Like
ttl(java.lang.String), this command returns the remaining time to live of a key that has an expire set, with the sole difference that TTL returns the amount of remaining time in seconds while PTTL returns it in milliseconds.- Parameters:
 key- the key to inspect.- Returns:
 - TTL in milliseconds, or a negative value in order to signal an error (see the description above).
 
 
- 
publish
long publish(String channel, String message)
From http://redis.io/commands/publish:
Available since 2.0.0.
Time complexity: O(N+M) where N is the number of clients subscribed to the receiving channel and M is the total number of subscribed patterns (by any client).
Posts a message to the given channel.
- Returns:
 - the number of clients that received the message.
 
 
- 
randomkey
String randomkey()
From http://redis.io/commands/randomkey:
Available since 1.0.0.
Time complexity: O(1)
Return a random key from the currently selected database.
- Returns:
 - the random key, or 
nullwhen the database is empty. 
 
- 
rename
boolean rename(String key, String newkey)
From http://redis.io/commands/rename:
Available since 1.0.0.
Time complexity: O(1)
Renames
keytonewkey. It returns an error when the source and destination names are the same, or whenkeydoes not exist. Ifnewkeyalready exists it is overwritten, when this happensrename(java.lang.String, java.lang.String)executes an implicitdel(java.lang.String, java.lang.String...)operation, so if the deleted key contains a very big value it may cause high latency even ifrename(java.lang.String, java.lang.String)itself is usually a constant-time operation.- Parameters:
 key- the old name.newkey- the new name.- Returns:
 - always true.
 
 
- 
renamenx
boolean renamenx(String key, String newkey)
From http://redis.io/commands/renamenx:
Available since 1.0.0.
Time complexity: O(1)
Renames
keytonewkeyifnewkeydoes not yet exist. It returns an error under the same conditions asrename(java.lang.String, java.lang.String).- Parameters:
 key- the old name.newkey- the new name.- Returns:
 - true if successful, false if not.
 
 
- 
restore
boolean restore(String key, long ttl, String serializedvalue)
From http://redis.io/commands/restore:
Available since 2.6.0.
Time complexity: O(1) to create the new key and additional O(N*M) to reconstruct the serialized value, where N is the number of Redis objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1*M) where M is small, so simply O(1). However for sorted set values the complexity is O(N*M*log(N)) because inserting values into sorted sets is O(log(N)).
Create a key associated with a value that is obtained by deserializing the provided serialized value (obtained via
dump(java.lang.String)).- Parameters:
 key- the key to restore.ttl- the time-to-live in milliseconds.serializedvalue- the serialized value (from adump(java.lang.String)call).- Returns:
 - always true.
 
 
- 
sort
String[] sort(String key, String pattern, SortOrder sortOrder, boolean alpha, Long limitOffset, Long limitCount, String storeKey, String... getPatterns)
From http://redis.io/commands/sort:
Available since 1.0.0.
Time complexity: O(N+M*log(M)) where N is the number of elements in the list or set to sort, and M the number of returned elements. When the elements are not sorted, complexity is currently O(N) as there is a copy step that will be avoided in next releases.
Returns or stores the elements contained in the list, set, or sorted set at
key. By default, sorting is numeric and elements are compared by their value interpreted as double precision floating point number.- Parameters:
 key- the key to sort the contents of.pattern- if not null,sortOrder- if true, sort descending. if false or null, sort ascending.alpha- if true, sort lexicographically, not by a score.limitOffset- if not null, the starting offset into the list (0-based).limitCount- if not null, the amount of objects from the offset to sort. else, return all the way to the end.storeKey- if not null, this is the key to store the result in.getPatterns- the patterns for finding the sort score.- Returns:
 - the list of sorted elements.
 
 
- 
ttl
long ttl(String key)
From http://redis.io/commands/ttl:
Available since 1.0.0.
Time complexity: O(1)
Returns the remaining time to live of a key that has a timeout. This introspection capability allows a Redis client to check how many seconds a given key will continue to be part of the dataset.
- Parameters:
 key- the key to inspect.- Returns:
 - TTL in seconds, or a negative value in order to signal an error (see description).
 
 
- 
type
DataType type(String key)
From http://redis.io/commands/type:
Available since 1.0.0.
Time complexity: O(1)
Returns the string representation of the type of the value stored at
key.- Returns:
 - the type of 
key, orDataType.NONEwhenkeydoes not exist. 
 
- 
append
long append(String key, String value)
From http://redis.io/commands/append:
Available since 2.0.0.
Time complexity: O(1). The amortized time complexity is O(1) assuming the appended value is small and the already present value is of any size, since the dynamic string library used by Redis will double the free space available on every reallocation.
If
keyalready exists and is a string, this command appends thevalueat the end of the string. Ifkeydoes not exist it is created and set as an empty string, so APPEND will be similar to SET in this special case.- Returns:
 - the length of the string after the append operation.
 
 
- 
bitcount
long bitcount(String key)
From http://redis.io/commands/bitcount:
Available since 2.6.0.
Time complexity: O(N)
Count the number of set bits (population counting) in a string.
- Returns:
 - the count.
 
 
- 
bitcount
long bitcount(String key, long start, long end)
From http://redis.io/commands/bitcount:
Available since 2.6.0.
Time complexity: O(N)
Count the number of set bits (population counting) in a string between a start and end bit.
- Returns:
 - the count.
 
 
- 
bitop
long bitop(BitwiseOperation operation, String destkey, String key, String... keys)
From http://redis.io/commands/bitop:
Available since 2.6.0.
Time complexity: O(N)
Perform a bitwise operation between multiple keys (containing string values) and store the result in the destination key.
- Returns:
 - the size of the string stored in the destination key, equal to the size of the longest input string.
 
 
- 
bitpos
long bitpos(String key, long bit)
From http://redis.io/commands/bitpos:
Available since 2.8.7.
Time complexity: O(N)
Return the position of the first bit set to 1 or 0 in a string.
- Returns:
 - the command returns the position of the first bit set to 1 or 0 according to the request.
 
 
- 
bitpos
long bitpos(String key, long bit, Long start, Long end)
From http://redis.io/commands/bitpos:
Available since 2.8.7.
Time complexity: O(N)
Return the position of the first bit set to 1 or 0 in a string.
- Returns:
 - the command returns the position of the first bit set to 1 or 0 according to the request.
 
 
- 
decr
long decr(String key)
From http://redis.io/commands/decr:
Available since 1.0.0.
Time complexity: O(1)
Decrements the number stored at
keyby one. If the key does not exist, it is set to0before performing the operation. An error is returned if the key contains a value of the wrong type or contains a string that can not be represented as integer. This operation is limited to 64 bit signed integers.- Returns:
 - the value of 
keyafter the decrement. 
 
- 
decrby
long decrby(String key, long decrement)
From http://redis.io/commands/decrby:
Available since 1.0.0.
Time complexity: O(1)
Decrements the number stored at
keybydecrement. If the key does not exist, it is set to0before performing the operation. An error is returned if the key contains a value of the wrong type or contains a string that can not be represented as integer. This operation is limited to 64 bit signed integers.- Returns:
 - the value of 
keyafter the decrement. 
 
- 
get
String get(String key)
From http://redis.io/commands/get:
Available since 1.0.0.
Time complexity: O(1)
Get the value of
key. If the key does not exist the special valuenullis returned. An error is returned if the value stored atkeyis not a string, because GET only handles string values.- Returns:
 - the value of 
key, ornullwhenkeydoes not exist. 
 
- 
getbit
long getbit(String key, long offset)
From http://redis.io/commands/getbit:
Available since 2.2.0.
Time complexity: O(1)
Returns the bit value at offset in the string value stored at key.
- Returns:
 - the bit value stored at offset.
 
 
- 
getrange
String getrange(String key, long start, long end)
From http://redis.io/commands/getrange:
Available since 2.4.0.
Time complexity: O(N) where N is the length of the returned string. The complexity is ultimately determined by the returned length, but because creating a substring from an existing string is very cheap, it can be considered O(1) for small strings. it is called
SUBSTRin Redis versions<= 2.0.- Returns:
 - the resultant substring.
 
 
- 
getset
String getset(String key, String value)
From http://redis.io/commands/getset:
Available since 1.0.0.
Time complexity: O(1)
Atomically sets
keytovalueand returns the old value stored atkey. Returns an error whenkeyexists but does not hold a string value.- Returns:
 - the old value stored at 
key, ornullwhenkeydid not exist. 
 
- 
getset
String getset(String key, Number value)
From http://redis.io/commands/getset:
Available since 1.0.0.
Time complexity: O(1)
Atomically sets
keytovalueand returns the old value stored atkey. Returns an error whenkeyexists but does not hold a string value.- Returns:
 - the old value stored at 
key, ornullwhenkeydid not exist. 
 
- 
incr
long incr(String key)
From http://redis.io/commands/incr:
Available since 1.0.0.
Time complexity: O(1)
Increments the number stored at
keyby one. If the key does not exist, it is set to0before performing the operation. An error is returned if the key contains a value of the wrong type or contains a string that can not be represented as integer. This operation is limited to 64 bit signed integers.- Returns:
 - the value of 
keyafter the increment, 
 
- 
incrby
long incrby(String key, long increment)
From http://redis.io/commands/incrby:
Available since 1.0.0.
Time complexity: O(1)
Increments the number stored at
keybyincrement. If the key does not exist, it is set to0before performing the operation. An error is returned if the key contains a value of the wrong type or contains a string that can not be represented as integer. This operation is limited to 64 bit signed integers.- Returns:
 - the value of 
keyafter the increment. 
 
- 
incrbyfloat
double incrbyfloat(String key, double increment)
From http://redis.io/commands/incrbyfloat:
Available since 2.6.0.
Time complexity: O(1)
Increment the string representing a floating point number stored at
keyby the specifiedincrement. If the key does not exist, it is set to0before performing the operation. An error is returned if one of the following conditions occur:- Returns:
 - the value of 
keyafter the increment. 
 
- 
mget
String[] mget(String key, String... keys)
From http://redis.io/commands/mget:
Available since 1.0.0.
Time complexity: O(N) where N is the number of keys to retrieve.
Returns the values of all specified keys. For every key that does not hold a string value or does not exist, the special value
nilis returned. Because of this, the operation never fails.- Returns:
 - list of values at the specified keys.
 
 
- 
mset
boolean mset(String key, String value, String... keyValues)
From http://redis.io/commands/mset:
Available since 1.0.1.
Time complexity: O(N) where N is the number of keys to set.
Sets the given keys to their respective values.
MSETreplaces existing values with new values, just as regular SET. Seemsetnx(java.lang.String, java.lang.String, java.lang.String...)if you don't want to overwrite existing values.- Returns:
 - true, always.
 
 
- 
mset
boolean mset(KeyValue<String,Object>... pairs)
Likemset(String, String, String...), but takes key-value pairs. 
- 
msetnx
boolean msetnx(String key, String value, String... keyValues)
From http://redis.io/commands/msetnx:
Available since 1.0.1.
Time complexity: O(N) where N is the number of keys to set.
Sets the given keys to their respective values.
MSETNXwill not perform any operation at all even if just a single key already exists.- Returns:
 - true if all of the keys were set, false if no key was set.
 
 
- 
msetnx
boolean msetnx(KeyValue<String,Object>... pairs)
Likemsetnx(String, String, String...), but takes key-value pairs. 
- 
psetex
boolean psetex(String key, long milliseconds, String value)
From http://redis.io/commands/psetex:
Available since 2.6.0.
Time complexity: O(1)
PSETEXworks exactly likesetex(String, long, String)with the sole difference that the expire time is specified in milliseconds instead of seconds.- Returns:
 - true, always.
 
 
- 
set
boolean set(String key, String value)
From http://redis.io/commands/set:
Available since 1.0.0.
Time complexity: O(1)
Set
keyto hold the stringvalue. Ifkeyalready holds a value, it is overwritten, regardless of its type. Any previous time to live associated with the key is discarded on successfulSEToperation.- Returns:
 - true, always.
 
 
- 
set
boolean set(String key, Number value)
From http://redis.io/commands/set:
Available since 1.0.0.
Time complexity: O(1)
Set
keyto hold the stringvalue. Ifkeyalready holds a value, it is overwritten, regardless of its type. Any previous time to live associated with the key is discarded on successfulSEToperation.- Returns:
 - true, always.
 
 
- 
setbit
long setbit(String key, long offset, long value)
From http://redis.io/commands/setbit:
Available since 2.2.0.
Time complexity: O(1)
Sets or clears the bit at offset in the string value stored at key.
- Returns:
 - the original bit value stored at offset.
 
 
- 
setex
boolean setex(String key, long seconds, String value)
From http://redis.io/commands/setex:
Available since 2.0.0.
Time complexity: O(1)
Set
keyto hold the stringvalueand setkeyto timeout after a given number of seconds. This command is equivalent to executing the following commands:- Returns:
 - true, always.
 
 
- 
setnx
boolean setnx(String key, String value)
From http://redis.io/commands/setnx:
Available since 1.0.0.
Time complexity: O(1)
Set
keyto hold stringvalueifkeydoes not exist. In that case, it is equal toset(String, String). Whenkeyalready holds a value, no operation is performed.SETNXis short for "SET if N ot e X ists".- Returns:
 - true if the key was set, false if not.
 
 
- 
setrange
long setrange(String key, long offset, String value)
From http://redis.io/commands/setrange:
Available since 2.2.0.
Time complexity: O(1), not counting the time taken to copy the new string in place. Usually, this string is very small so the amortized complexity is O(1). Otherwise, complexity is O(M) with M being the length of the value argument.
Overwrites part of the string stored at key, starting at the specified offset, for the entire length of value. If the offset is larger than the current length of the string at key, the string is padded with zero-bytes to make offset fit. Non-existing keys are considered as empty strings, so this command will make sure it holds a string large enough to be able to set value at offset.
- Returns:
 - the length of the string after it was modified by the command.
 
 
- 
strlen
long strlen(String key)
From http://redis.io/commands/strlen:
Available since 2.2.0.
Time complexity: O(1)
Returns the length of the string value stored at
key. An error is returned whenkeyholds a non-string value.- Returns:
 - the length of the string at 
key, or0whenkeydoes not exist. 
 
- 
hdel
long hdel(String key, String field, String... fields)
From http://redis.io/commands/hdel:
Available since 2.0.0.
Time complexity: O(N) where N is the number of fields to be removed.
Removes the specified fields from the hash stored at
key. Specified fields that do not exist within this hash are ignored. Ifkeydoes not exist, it is treated as an empty hash and this command returns0.- Returns:
 - the number of fields that were removed from the hash, not including specified but non existing fields.
 
 
- 
hexists
boolean hexists(String key, String field)
From http://redis.io/commands/hexists:
Available since 2.0.0.
Time complexity: O(1)
Returns if
fieldis an existing field in the hash stored atkey.- Returns:
 - true if successful, false if not.
 
 
- 
hget
String hget(String key, String field)
From http://redis.io/commands/hget:
Available since 2.0.0.
Time complexity: O(1)
Returns the value associated with
fieldin the hash stored atkey.- Returns:
 - the value associated with 
field, ornullwhenfieldis not present in the hash orkeydoes not exist. 
 
- 
hgetall
String[] hgetall(String key)
From http://redis.io/commands/hgetall:
Available since 2.0.0.
Time complexity: O(N) where N is the size of the hash.
Returns all fields and values of the hash stored at
key. In the returned value, every field name is followed by its value, so the length of the reply is twice the size of the hash.- Returns:
 - a list of fields and their values stored in the hash, or an empty 
 list when 
keydoes not exist. 
 
- 
hincrby
long hincrby(String key, String field, long increment)
From http://redis.io/commands/hincrby:
Available since 2.0.0.
Time complexity: O(1)
Increments the number stored at
fieldin the hash stored atkeybyincrement. Ifkeydoes not exist, a new key holding a hash is created. Iffielddoes not exist the value is set to0before the operation is performed.- Returns:
 - the value at 
fieldafter the increment operation. 
 
- 
hincrbyfloat
double hincrbyfloat(String key, String field, double increment)
From http://redis.io/commands/hincrbyfloat:
Available since 2.6.0.
Time complexity: O(1)
Increment the specified
fieldof an hash stored atkey, and representing a floating point number, by the specifiedincrement. If the field does not exist, it is set to0before performing the operation.- Returns:
 - the value of 
fieldafter the increment. 
 
- 
hkeys
String[] hkeys(String key)
From http://redis.io/commands/hkeys:
Available since 2.0.0.
Time complexity: O(N) where N is the size of the hash.
Returns all field names in the hash stored at
key.- Returns:
 - the list of fields in the hash, or an empty list when 
keydoes not exist. 
 
- 
hlen
long hlen(String key)
From http://redis.io/commands/hlen:
Available since 2.0.0.
Time complexity: O(1)
Returns the number of fields contained in the hash stored at
key.- Returns:
 - the number of fields in the hash, or 
0whenkeydoes not exist. 
 
- 
hmget
String[] hmget(String key, String field, String... fields)
From http://redis.io/commands/hmget:
Available since 2.0.0.
Time complexity: O(N) where N is the number of fields being requested.
Returns the values associated with the specified
fieldsin the hash stored atkey.- Returns:
 - a list of values associated with the given fields, in the same order as they are requested.
 
 
- 
hmset
boolean hmset(String key, String field, String value, String... fieldvalues)
From http://redis.io/commands/hmset:
Available since 2.0.0.
Time complexity: O(N) where N is the number of fields being set.
Sets the specified fields to their respective values in the hash stored at
key. This command overwrites any existing fields in the hash. Ifkeydoes not exist, a new key holding a hash is created.Parameters should alternate between field, value, field, value ...
- Returns:
 - always true.
 
 
- 
hmset
boolean hmset(String key, KeyValue<String,Object>... pairs)
From http://redis.io/commands/hmset:
Available since 2.0.0.
Time complexity: O(N) where N is the number of fields being set.
Sets the specified fields to their respective values in the hash stored at
key. This command overwrites any existing fields in the hash. Ifkeydoes not exist, a new key holding a hash is created.- Returns:
 - always true.
 
 
- 
hset
boolean hset(String key, String field, String value)
From http://redis.io/commands/hset:
Available since 2.0.0.
Time complexity: O(1)
Sets
fieldin the hash stored atkeytovalue. Ifkeydoes not exist, a new key holding a hash is created. Iffieldalready exists in the hash, it is overwritten.- Returns:
 - true if a new field, false if set, but not a new field.
 
 
- 
hset
boolean hset(String key, String field, Number value)
From http://redis.io/commands/hset:
Available since 2.0.0.
Time complexity: O(1)
Sets
fieldin the hash stored atkeytovalue. Ifkeydoes not exist, a new key holding a hash is created. Iffieldalready exists in the hash, it is overwritten.- Returns:
 - true if a new field, false if set, but not a new field.
 
 
- 
hsetnx
boolean hsetnx(String key, String field, String value)
From http://redis.io/commands/hsetnx:
Available since 2.0.0.
Time complexity: O(1)
Sets
fieldin the hash stored atkeytovalue, only iffielddoes not yet exist. Ifkeydoes not exist, a new key holding a hash is created. Iffieldalready exists, this operation has no effect.- Returns:
 - true if a new field, false if set, but not a new field.
 
 
- 
hsetnx
boolean hsetnx(String key, String field, Number value)
From http://redis.io/commands/hsetnx:
Available since 2.0.0.
Time complexity: O(1)
Sets
fieldin the hash stored atkeytovalue, only iffielddoes not yet exist. Ifkeydoes not exist, a new key holding a hash is created. Iffieldalready exists, this operation has no effect.- Returns:
 - true if a new field, false if set, but not a new field.
 
 
- 
hvals
String[] hvals(String key)
From http://redis.io/commands/hvals:
Available since 2.0.0.
Time complexity: O(N) where N is the size of the hash.
Returns all values in the hash stored at
key.- Returns:
 - a list of values in the hash, or an empty list when 
keydoes not exist. 
 
- 
blpop
KeyValue<String,String> blpop(long timeout, String key, String... keys)
From http://redis.io/commands/blpop:
Available since 2.0.0.
Time complexity: O(1)
BLPOPis a blocking list pop primitive. It is the blocking version oflpop(String)because it blocks the connection when there are no elements to pop from any of the given lists. An element is popped from the head of the first list that is non-empty, with the given keys being checked in the order that they are given. Atimeoutof zero can be used to block indefinitely. Timeout is in seconds.- Returns:
 - an object pair consisting of popped list key and the value popped, or null on timeout.
 
 
- 
brpop
KeyValue<String,String> brpop(long timeout, String key, String... keys)
From http://redis.io/commands/brpop:
Available since 2.0.0.
Time complexity: O(1)
BRPOPis a blocking list pop primitive. It is the blocking version ofrpop(java.lang.String)because it blocks the connection when there are no elements to pop from any of the given lists. An element is popped from the tail of the first list that is non-empty, with the given keys being checked in the order that they are given. Atimeoutof zero can be used to block indefinitely. Timeout is in seconds.- Returns:
 - an object pair consisting of popped list key and the value popped, or null on timeout.
 
 
- 
brpoplpush
String brpoplpush(long timeout, String source, String destination)
From http://redis.io/commands/brpoplpush:
Available since 2.2.0.
Time complexity: O(1)
BRPOPLPUSHis the blocking variant ofrpoplpush(String, String). Whensourcecontains elements, this command behaves exactly likerpoplpush(String, String). Whensourceis empty, Redis will block the connection until another client pushes to it or untiltimeoutis reached. Atimeoutof zero can be used to block indefinitely. Timeout is in seconds.- Returns:
 - the value popped-then-pushed to destination from source, or null on timeout.
 
 
- 
lindex
String lindex(String key, long index)
From http://redis.io/commands/lindex:
Available since 1.0.0.
Time complexity: O(N) where N is the number of elements to traverse to get to the element at index. This makes asking for the first or the last element of the list O(1).
Returns the element at index
indexin the list stored atkey. The index is zero-based, so0means the first element,1the second element and so on. Negative indices can be used to designate elements starting at the tail of the list. Here,-1means the last element,-2means the penultimate and so forth.- Returns:
 - the requested element, or 
nullwhenindexis out of range. 
 
- 
linsert
long linsert(String key, boolean before, String pivot, String value)
From http://redis.io/commands/linsert:
Available since 2.2.0.
Time complexity: O(N) where N is the number of elements to traverse before seeing the value pivot. This means that inserting somewhere on the left end on the list (head) can be considered O(1) and inserting somewhere on the right end (tail) is O(N).
Inserts
valuein the list stored atkeyeither before or after the reference valuepivot.- Returns:
 - the length of the list after the insert operation, or 
-1when the valuepivotwas not found. 
 
- 
linsert
long linsert(String key, boolean before, String pivot, Number value)
From http://redis.io/commands/linsert:
Available since 2.2.0.
Time complexity: O(N) where N is the number of elements to traverse before seeing the value pivot. This means that inserting somewhere on the left end on the list (head) can be considered O(1) and inserting somewhere on the right end (tail) is O(N).
Inserts
valuein the list stored atkeyeither before or after the reference valuepivot.- Returns:
 - the length of the list after the insert operation, or 
-1when the valuepivotwas not found. 
 
- 
llen
long llen(String key)
From http://redis.io/commands/llen:
Available since 1.0.0.
Time complexity: O(1)
Returns the length of the list stored at
key. Ifkeydoes not exist, it is interpreted as an empty list and0is returned. An error is returned when the value stored atkeyis not a list.- Returns:
 - the length of the list at 
key. 
 
- 
lpop
String lpop(String key)
From http://redis.io/commands/lpop:
Available since 1.0.0.
Time complexity: O(1)
Removes and returns the first element of the list stored at
key.- Returns:
 - the value of the first element, or 
nullwhenkeydoes not exist. 
 
- 
lpush
long lpush(String key, String value, String... values)
From http://redis.io/commands/lpush:
Available since 1.0.0.
Time complexity: O(1)
Insert all the specified values at the head of the list stored at
key. Ifkeydoes not exist, it is created as empty list before performing the push operations. Whenkeyholds a value that is not a list, an error is returned.- Returns:
 - the length of the list after the push operations.
 
 
- 
lpushx
long lpushx(String key, String value)
From http://redis.io/commands/lpushx:
Available since 2.2.0.
Time complexity: O(1)
Inserts
valueat the head of the list stored atkey, only ifkeyalready exists and holds a list. In contrary tolpush(java.lang.String, java.lang.String, java.lang.String...), no operation will be performed whenkeydoes not yet exist.- Returns:
 - the length of the list after the push operation.
 
 
- 
lrange
String[] lrange(String key, long start, long stop)
From http://redis.io/commands/lrange:
Available since 1.0.0.
Time complexity: O(S+N) where S is the start offset and N is the number of elements in the specified range.
Returns the specified elements of the list stored at
key. The offsetsstartandstopare zero-based indexes, with0being the first element of the list (the head of the list),1being the next element and so on.- Returns:
 - list of elements in the specified range.
 
 
- 
lrem
long lrem(String key, long count, String value)
From http://redis.io/commands/lrem:
Available since 1.0.0.
Time complexity: O(N) where N is the length of the list.
Removes the first
countoccurrences of elements equal tovaluefrom the list stored atkey. Thecountargument influences the operation in the following ways:count > 0: Remove elements equal tovaluemoving from head to tail.count < 0: Remove elements equal tovaluemoving from tail to head.count = 0: Remove all elements equal tovalue.
- Returns:
 - the number of removed elements.
 
 
- 
lset
boolean lset(String key, long index, String value)
From http://redis.io/commands/lset:
Available since 1.0.0.
Time complexity: O(N) where N is the length of the list. Setting either the first or the last element of the list is O(1).
Sets the list element at
indextovalue. For more information on theindexargument, seelindex(String, long).- Returns:
 - always true.
 
 
- 
ltrim
boolean ltrim(String key, long start, long stop)
From http://redis.io/commands/ltrim:
Available since 1.0.0.
Time complexity: O(N) where N is the number of elements to be removed by the operation.
Trim an existing list so that it will contain only the specified range of elements specified. Both
startandstopare zero-based indexes, where0is the first element of the list (the head),1the next element and so on.- Returns:
 - always true.
 
 
- 
rpop
String rpop(String key)
From http://redis.io/commands/rpop:
Available since 1.0.0.
Time complexity: O(1)
Removes and returns the last element of the list stored at
key.- Returns:
 - the value of the last element, or 
nullwhenkeydoes not exist. 
 
- 
rpoplpush
String rpoplpush(String source, String destination)
From http://redis.io/commands/rpoplpush:
Available since 1.2.0.
Time complexity: O(1)
Atomically returns and removes the last element (tail) of the list stored at
source, and pushes the element at the first element (head) of the list stored atdestination.- Returns:
 - the element being popped and pushed.
 
 
- 
rpush
long rpush(String key, String value, String... values)
From http://redis.io/commands/rpush:
Available since 1.0.0.
Time complexity: O(1)
Insert all the specified values at the tail of the list stored at
key. Ifkeydoes not exist, it is created as empty list before performing the push operation. Whenkeyholds a value that is not a list, an error is returned.- Returns:
 - the length of the list after the push operation.
 
 
- 
rpushx
long rpushx(String key, String value)
From http://redis.io/commands/rpushx:
Available since 2.2.0.
Time complexity: O(1)
Inserts
valueat the tail of the list stored atkey, only ifkeyalready exists and holds a list. In contrary torpush(java.lang.String, java.lang.String, java.lang.String...), no operation will be performed whenkeydoes not yet exist.- Returns:
 - the length of the list after the push operation.
 
 
- 
sadd
long sadd(String key, String member, String... members)
From http://redis.io/commands/sadd:
Available since 1.0.0.
Time complexity: O(N) where N is the number of members to be added.
Add the specified members to the set stored at
key. Specified members that are already a member of this set are ignored. Ifkeydoes not exist, a new set is created before adding the specified members.- Returns:
 - the number of elements that were added to the set, not including all the elements already present into the set.
 
 
- 
sadd
long sadd(String key, Object member, Object... members)
From http://redis.io/commands/sadd:
Available since 1.0.0.
Time complexity: O(N) where N is the number of members to be added.
Add the specified members to the set stored at
key. Specified members that are already a member of this set are ignored. Ifkeydoes not exist, a new set is created before adding the specified members. 
- 
scard
long scard(String key)
From http://redis.io/commands/scard:
Available since 1.0.0.
Time complexity: O(1)
Returns the set cardinality (number of elements) of the set stored at
key.- Returns:
 - the cardinality (number of elements) of the set, or 
0ifkeydoes not exist. 
 
- 
sdiff
String[] sdiff(String key, String... keys)
From http://redis.io/commands/sdiff:
Available since 1.0.0.
Time complexity: O(N) where N is the total number of elements in all given sets.
Returns the members of the set resulting from the difference between the first set and all the successive sets.
- Returns:
 - list with members of the resulting set.
 
 
- 
sdiffstore
long sdiffstore(String destination, String key, String... keys)
From http://redis.io/commands/sdiffstore:
Available since 1.0.0.
Time complexity: O(N) where N is the total number of elements in all given sets.
This command is equal to SDIFF, but instead of returning the resulting set, it is stored in
destination.- Returns:
 - the number of elements in the resulting set.
 
 
- 
sinter
String[] sinter(String key, String... keys)
From http://redis.io/commands/sinter:
Available since 1.0.0.
Time complexity: O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets.
Returns the members of the set resulting from the intersection of all the given sets.
- Returns:
 - list with members of the resulting set.
 
 
- 
sinterstore
long sinterstore(String destination, String key, String... keys)
From http://redis.io/commands/sinterstore:
Available since 1.0.0.
Time complexity: O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets.
This command is equal to SINTER, but instead of returning the resulting set, it is stored in
destination.- Returns:
 - the number of elements in the resulting set.
 
 
- 
sismember
boolean sismember(String key, String member)
From http://redis.io/commands/sismember:
Available since 1.0.0.
Time complexity: O(1)
Returns if
memberis a member of the set stored atkey.- Returns:
 - true if the member is in the set, or false if not.
 
 
- 
sismember
boolean sismember(String key, Number member)
From http://redis.io/commands/sismember:
Available since 1.0.0.
Time complexity: O(1)
Returns if
memberis a member of the set stored atkey.- Returns:
 - true if the member is in the set, or false if not.
 
 
- 
smembers
String[] smembers(String key)
From http://redis.io/commands/smembers:
Available since 1.0.0.
Time complexity: O(N) where N is the set cardinality.
Returns all the members of the set value stored at
key.- Returns:
 - all elements of the set.
 
 
- 
smove
boolean smove(String source, String destination, String member)
From http://redis.io/commands/smove:
Available since 1.0.0.
Time complexity: O(1)
Move
memberfrom the set atsourceto the set atdestination. This operation is atomic. In every given moment the element will appear to be a member ofsourceordestinationfor other clients.- Returns:
 - true if the move of the member is successful, or false if the source list did not contain the member to move.
 
 
- 
spop
String spop(String key)
From http://redis.io/commands/spop:
Available since 1.0.0.
Time complexity: O(1)
Removes and returns a random element from the set value stored at
key.- Returns:
 - the removed element, or 
nullwhenkeydoes not exist. 
 
- 
srandmember
String srandmember(String key)
From http://redis.io/commands/srandmember:
Available since 1.0.0.
Time complexity: O(1).
When called with just the
keyargument, return a random element from the set value stored atkey.- Returns:
 - the randomly selected element, or 
nullwhenkeydoes not exist. 
 
- 
srandmember
String[] srandmember(String key, long count)
From http://redis.io/commands/srandmember:
Available since 1.0.0.
Time complexity: O(N) where N is the absolute value of the passed count.
When called with just the
keyargument, return a random element from the set value stored atkey.- Returns:
 - an array of elements, or an empty array when 
keydoes not exist. 
 
- 
srem
long srem(String key, String member, String... members)
From http://redis.io/commands/srem:
Available since 1.0.0.
Time complexity: O(N) where N is the number of members to be removed.
Remove the specified members from the set stored at
key. Specified members that are not a member of this set are ignored. Ifkeydoes not exist, it is treated as an empty set and this command returns0.- Returns:
 - the number of members that were removed from the set, not including non existing members.
 
 
- 
srem
long srem(String key, Object member, Object... members)
From http://redis.io/commands/srem:
Available since 1.0.0.
Time complexity: O(N) where N is the number of members to be removed.
Remove the specified members from the set stored at
key. Specified members that are not a member of this set are ignored. Ifkeydoes not exist, it is treated as an empty set and this command returns0.- Returns:
 - the number of members that were removed from the set, not including non existing members.
 
 
- 
sunion
String[] sunion(String key, String... keys)
From http://redis.io/commands/sunion:
Available since 1.0.0.
Time complexity: O(N) where N is the total number of elements in all given sets.
Returns the members of the set resulting from the union of all the given sets.
- Returns:
 - list with members of the resulting set.
 
 
- 
sunionstore
long sunionstore(String destination, String key, String... keys)
From http://redis.io/commands/sunionstore:
Available since 1.0.0.
Time complexity: O(N) where N is the total number of elements in all given sets.
This command is equal to SUNION, but instead of returning the resulting set, it is stored in
destination.- Returns:
 - the number of elements in the resulting set.
 
 
- 
zadd
long zadd(String key, double score, String member)
From http://redis.io/commands/zadd:
Available since 1.2.0.
Time complexity: O(log(N)) where N is the number of elements in the sorted set.
Adds all the specified members with the specified scores to the sorted set stored at
key. It is possible to specify multiple score/member pairs. If a specified member is already a member of the sorted set, the score is updated and the element reinserted at the right position to ensure the correct ordering. Ifkeydoes not exist, a new sorted set with the specified members as sole members is created, like if the sorted set was empty. If the key exists but does not hold a sorted set, an error is returned.- Returns:
 - the number of elements added to the sorted sets, not including elements already existing for which the score was updated.
 
 
- 
zadd
long zadd(String key, double score, Number member)
From http://redis.io/commands/zadd:
Available since 1.2.0.
Time complexity: O(log(N)) where N is the number of elements in the sorted set.
Adds all the specified members with the specified scores to the sorted set stored at
key. It is possible to specify multiple score/member pairs. If a specified member is already a member of the sorted set, the score is updated and the element reinserted at the right position to ensure the correct ordering. Ifkeydoes not exist, a new sorted set with the specified members as sole members is created, like if the sorted set was empty. If the key exists but does not hold a sorted set, an error is returned. 
- 
zadd
long zadd(String key, KeyValue<Double,String>... pairs)
From http://redis.io/commands/zadd:
Available since 1.2.0.
Time complexity: O(log(N)) where N is the number of elements in the sorted set.
Adds all the specified members with the specified scores to the sorted set stored at
key. It is possible to specify multiple score/member pairs. If a specified member is already a member of the sorted set, the score is updated and the element reinserted at the right position to ensure the correct ordering. Ifkeydoes not exist, a new sorted set with the specified members as sole members is created, like if the sorted set was empty. If the key exists but does not hold a sorted set, an error is returned.- Returns:
 - the number of elements added to the sorted sets, not including elements already existing for which the score was updated.
 
 
- 
zcard
long zcard(String key)
From http://redis.io/commands/zcard:
Available since 1.2.0.
Time complexity: O(1)
Returns the sorted set cardinality (number of elements) of the sorted set stored at
key.- Returns:
 - the cardinality (number of elements) of the sorted set, or 
0ifkeydoes not exist. 
 
- 
zcount
long zcount(String key, String min, String max)
From http://redis.io/commands/zcount:
Available since 2.0.0.
Time complexity: O(log(N)) with N being the number of elements in the sorted set.
Returns the number of elements in the sorted set at
keywith a score betweenminandmax.The arguments
minandmaxare Strings so they can accept special ranges.- Returns:
 - the number of elements in the specified score range.
 
 
- 
zcount
long zcount(String key, double min, double max)
Likezcount(String, String, String), except it accepts doubles for min and max, not strings. 
- 
zincrby
double zincrby(String key, double increment, String member)
From http://redis.io/commands/zincrby:
Available since 1.2.0.
Time complexity: O(log(N)) where N is the number of elements in the sorted set.
Increments the score of
memberin the sorted set stored atkeybyincrement. Ifmemberdoes not exist in the sorted set, it is added withincrementas its score (as if its previous score was0.0). Ifkeydoes not exist, a new sorted set with the specifiedmemberas its sole member is created.- Returns:
 - the new score of 
member(a double precision floating point number). 
 
- 
zrange
String[] zrange(String key, long start, long stop, boolean withScores)
From http://redis.io/commands/zrange:
Available since 1.2.0.
Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements returned.
Returns the specified range of elements in the sorted set stored at
key. The elements are considered to be ordered from the lowest to the highest score. Lexicographical order is used for elements with equal score.- Returns:
 - list of elements in the specified range (optionally with their scores).
 
 
- 
zrangebyscore
String[] zrangebyscore(String key, String min, String max, boolean withScores, Long limitOffset, Long limitCount)
From http://redis.io/commands/zrangebyscore:
Available since 1.0.5.
Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements being returned. If M is constant (e.g. always asking for the first 10 elements with LIMIT), you can consider it O(log(N)).
Returns all the elements in the sorted set at
keywith a score betweenminandmax(including elements with score equal tominormax). The elements are considered to be ordered from low to high scores.The optional
LIMITargument can be used to only get a range of the matching elements (similar to SELECT LIMIT offset, count in SQL). Keep in mind that ifoffsetis large, the sorted set needs to be traversed foroffsetelements before getting to the elements to return, which can add up to O(N) time complexity.The arguments
minandmaxare Strings so they can accept special ranges.- Returns:
 - list of elements in the specified score range (optionally with their scores).
 
 
- 
zrangebyscore
String[] zrangebyscore(String key, double min, double max, boolean withScores)
Likezrangebyscore(String, String, String, boolean), except it accepts doubles for min and max, not strings. 
- 
zrangebyscore
String[] zrangebyscore(String key, String min, String max, boolean withScores)
Likezrangebyscore(String, String, String, boolean, Long, Long), except specifies no limit. 
- 
zrangebyscore
String[] zrangebyscore(String key, double min, double max, boolean withScores, Long limitOffset, Long limitCount)
Likezrangebyscore(String, String, String, boolean, Long, Long), except it accepts doubles for min and max, not strings. 
- 
zrank
Long zrank(String key, String member)
From http://redis.io/commands/zrank:
Available since 2.0.0.
Time complexity: O(log(N))
Returns the rank of
memberin the sorted set stored atkey, with the scores ordered from low to high. The rank (or index) is 0-based, which means that the member with the lowest score has rank0.- Returns:
 - If 
memberexists in the sorted set, the rank ofmember. Ifmemberdoes not exist in the sorted set orkeydoes not exist,null. 
 
- 
zrank
Long zrank(String key, Number member)
From http://redis.io/commands/zrank:
Available since 2.0.0.
Time complexity: O(log(N))
Returns the rank of
memberin the sorted set stored atkey, with the scores ordered from low to high. The rank (or index) is 0-based, which means that the member with the lowest score has rank0.- Returns:
 - If 
memberexists in the sorted set, the rank ofmember. Ifmemberdoes not exist in the sorted set orkeydoes not exist,null. 
 
- 
zrem
long zrem(String key, String member, String... members)
From http://redis.io/commands/zrem:
Available since 1.2.0.
Time complexity: O(M*log(N)) with N being the number of elements in the sorted set and M the number of elements to be removed.
Removes the specified members from the sorted set stored at
key. Non existing members are ignored.- Returns:
 - the number of members removed from the sorted set, not including non existing members.
 
 
- 
zrem
long zrem(String key, Number member, Number... members)
From http://redis.io/commands/zrem:
Available since 1.2.0.
Time complexity: O(M*log(N)) with N being the number of elements in the sorted set and M the number of elements to be removed.
Removes the specified members from the sorted set stored at
key. Non existing members are ignored.- Returns:
 - the number of members removed from the sorted set, not including non existing members.
 
 
- 
zremrangebyrank
long zremrangebyrank(String key, long start, long stop)
From http://redis.io/commands/zremrangebyrank:
Available since 2.0.0.
Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements removed by the operation.
Removes all elements in the sorted set stored at
keywith rank betweenstartandstop. Bothstartandstopare0-based indexes with0being the element with the lowest score. These indexes can be negative numbers, where they indicate offsets starting at the element with the highest score. For example:-1is the element with the highest score,-2the element with the second highest score and so forth.- Returns:
 - the number of elements removed.
 
 
- 
zremrangebyscore
long zremrangebyscore(String key, String min, String max)
From http://redis.io/commands/zremrangebyscore:
Available since 1.2.0.
Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements removed by the operation.
Removes all elements in the sorted set stored at
keywith a score betweenminandmax(inclusive).The arguments
minandmaxare Strings so they can accept special ranges.- Returns:
 - the number of elements removed.
 
 
- 
zremrangebyscore
long zremrangebyscore(String key, double min, double max)
Likezremrangebyscore(String, String, String), except it accepts doubles for min and max, not strings. 
- 
zrevrank
Long zrevrank(String key, String member)
From http://redis.io/commands/zrevrank:
Available since 2.0.0.
Time complexity: O(log(N))
Returns the rank of
memberin the sorted set stored atkey, with the scores ordered from high to low. The rank (or index) is 0-based, which means that the member with the highest score has rank0.- Returns:
 - If 
memberexists in the sorted set, the rank ofmember. Ifmemberdoes not exist in the sorted set orkeydoes not exist,null. 
 
- 
zrevrange
String[] zrevrange(String key, long start, long stop, boolean withScores)
From http://redis.io/commands/zrevrange:
Available since 1.2.0.
Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements returned.
Returns the specified range of elements in the sorted set stored at
key. The elements are considered to be ordered from the highest to the lowest score. Descending lexicographical order is used for elements with equal score.- Returns:
 - list of elements in the specified range (optionally with their scores).
 
 
- 
zrevrangebyscore
String[] zrevrangebyscore(String key, String min, String max, boolean withScores, Long limitOffset, Long limitCount)
From http://redis.io/commands/zrevrangebyscore:
Available since 2.2.0.
Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements removed by the operation.
Returns all the elements in the sorted set at key with a score between
maxandmin(including elements with score equal to max or min). In contrary to the default ordering of sorted sets, for this command the elements are considered to be ordered from high to low scores.The optional
LIMITargument can be used to only get a range of the matching elements (similar to SELECT LIMIT offset, count in SQL). Keep in mind that ifoffsetis large, the sorted set needs to be traversed foroffsetelements before getting to the elements to return, which can add up to O(N) time complexity.The arguments
minandmaxare Strings so they can accept special ranges.- Returns:
 - list of elements in the specified score range (optionally with their scores).
 
 
- 
zrevrangebyscore
String[] zrevrangebyscore(String key, double min, double max, boolean withScores)
Likezrevrangebyscore(String, String, String, boolean), except it accepts doubles for min and max, not strings. 
- 
zrevrangebyscore
String[] zrevrangebyscore(String key, String min, String max, boolean withScores)
Likezrevrangebyscore(String, String, String, boolean, Long, Long), except specifies no limit. 
- 
zrevrangebyscore
String[] zrevrangebyscore(String key, double min, double max, boolean withScores, Long limitOffset, Long limitCount)
Likezrevrangebyscore(String, String, String, boolean, Long, Long), except it accepts doubles for min and max, not strings. 
- 
zscore
Double zscore(String key, String member)
From http://redis.io/commands/zscore:
Available since 1.2.0.
Time complexity: O(1)
Returns the score of
memberin the sorted set atkey.- Returns:
 - the score of 
member(a double precision floating point number). 
 
- 
zinterstore
long zinterstore(String destination, double[] weights, Aggregation aggregation, String key, String... keys)
From http://redis.io/commands/zinterstore:
Available since 2.0.0.
Time complexity: O(N*K)+O(M*log(M)) worst case with N being the smallest input sorted set, K being the number of input sorted sets and M being the number of elements in the resulting sorted set.
Computes the intersection of
numkeyssorted sets given by the specified keys, and stores the result indestination. It is mandatory to provide the number of input keys (numkeys) before passing the input keys and the other (optional) arguments.- Returns:
 - the number of elements in the resulting sorted set at 
destination. 
 
- 
zunionstore
long zunionstore(String destination, double[] weights, Aggregation aggregation, String key, String... keys)
From http://redis.io/commands/zunionstore:
Available since 2.0.0.
Time complexity: O(N)+O(M log(M)) with N being the sum of the sizes of the input sorted sets, and M being the number of elements in the resulting sorted set.
Computes the union of
numkeyssorted sets given by the specified keys, and stores the result indestination. It is mandatory to provide the number of input keys (numkeys) before passing the input keys and the other (optional) arguments.- Returns:
 - the number of elements in the resulting sorted set at 
destination. 
 
- 
zlexcount
long zlexcount(String key, String min, String max)
From http://redis.io/commands/zlexcount:
Available since 2.8.9.
Time complexity: O(log(N)) with N being the number of elements in the sorted set.
When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returns the number of elements in the sorted set at
keywith a value betweenminandmax.The arguments
minandmaxare Strings so they can accept special ranges.- Returns:
 - the number of elements in the specified score range.
 
 
- 
zrangebylex
long zrangebylex(String key, String min, String max, Long limitOffset, Long limitCount)
From http://redis.io/commands/zrangebylex:
Available since 2.8.9.
Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements being returned. If M is constant (e.g. always asking for the first 10 elements with LIMIT), you can consider it O(log(N)).
When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returns all the elements in the sorted set at
keywith a value betweenminandmax.The optional
LIMITargument can be used to only get a range of the matching elements (similar to SELECT LIMIT offset, count in SQL). Keep in mind that ifoffsetis large, the sorted set needs to be traversed foroffsetelements before getting to the elements to return, which can add up to O(N) time complexity.The arguments
minandmaxare Strings so they can accept special ranges.- Returns:
 - list of elements in the specified score range.
 
 
- 
zremrangebylex
long zremrangebylex(String key, String min, String max)
From http://redis.io/commands/zremrangebylex:
Available since 2.8.9.
Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements removed by the operation.
When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command removes all elements in the sorted set stored at
keybetween the lexicographical range specified byminandmax.The arguments
minandmaxare Strings so they can accept special ranges.- Returns:
 - the number of elements removed.
 
 
- 
zinterstore
long zinterstore(String destination, Aggregation aggregation, String key, String... keys)
Likezinterstore(String, double[], Aggregation, String, String...), except no weights are applied to the source value scores.Equivalent to:
zinterstore(destination, null, aggregation, key, keys) 
- 
zinterstore
long zinterstore(String destination, double[] weights, String key, String... keys)
Likezinterstore(String, double[], Aggregation, String, String...), except it does no aggregation of scores.Equivalent to:
zinterstore(destination, weights, null, key, keys) 
- 
zinterstore
long zinterstore(String destination, String key, String... keys)
Likezinterstore(String, double[], Aggregation, String, String...), except no weights are applied to the source value scores, and does no aggregation of scores.Equivalent to:
zinterstore(destination, null, null, key, keys) 
- 
zunionstore
long zunionstore(String destination, Aggregation aggregation, String key, String... keys)
Likezunionstore(String, double[], Aggregation, String, String...), except no weights are applied to the source value scores.Equivalent to:
zunionstore(destination, null, aggregation, key, keys) 
- 
zunionstore
long zunionstore(String destination, double[] weights, String key, String... keys)
Likezunionstore(String, double[], Aggregation, String, String...), except it does no aggregation of scores.Equivalent to:
zunionstore(destination, weights, null, key, keys) 
- 
zunionstore
long zunionstore(String destination, String key, String... keys)
Likezunionstore(String, double[], Aggregation, String, String...), except no weights are applied to the source value scores, and does no aggregation of scores.Equivalent to:
zunionstore(destination, null, null, key, keys) 
- 
zlexcount
long zlexcount(String key, double min, double max)
Likezlexcount(String, String, String), except it accepts doubles for min and max, not strings. 
- 
zrangebylex
long zrangebylex(String key, double min, double max, Long limitOffset, Long limitCount)
Likezrangebylex(String, String, String, Long, Long), except it accepts doubles for min and max, not strings. 
- 
zrangebylex
long zrangebylex(String key, String min, String max)
Likezrangebylex(String, String, String, Long, Long), with no limit. 
- 
zrangebylex
long zrangebylex(String key, double min, double max)
Likezrangebylex(String, String, String), except it accepts doubles for min and max, not strings, with no limit. 
- 
zremrangebylex
long zremrangebylex(String key, double min, double max)
Likezrangebylex(String, String, String), except it accepts doubles for min and max. 
- 
eval
RedisObject eval(String scriptContent, String[] keys, Object... args)
From http://redis.io/commands/eval:
Available since 2.6.0.
Time complexity: Depends on the script that is executed.
Evaluates a Lua script. The keys specified in
keysshould be used as a hint for Redis as to what keys are touched during the script call.- Returns:
 - the content returned by the script. Can be null.
 
 
- 
evalsha
RedisObject evalsha(String hash, String[] keys, Object... args)
From http://redis.io/commands/evalsha:
Available since 2.6.0.
Time complexity: Depends on the script that is executed.
Evaluates a script cached on the server side by its SHA1 digest. Scripts are cached on the server side using the
scriptLoad(java.lang.String)command. The command is otherwise identical toeval(String, String[], Object...).- Returns:
 - the content returned by the script. Can be null.
 
 
- 
scriptExists
boolean[] scriptExists(String scriptHash, String... scriptHashes)
From http://redis.io/commands/script-exists:
Available since 2.6.0.
Time complexity: O(N) with N being the number of scripts to check (so checking a single script is an O(1) operation).
Returns information about the existence of the scripts in the script cache.
- Returns:
 - The command returns an array of booleans that correspond to the specified SHA1 digest arguments. For every corresponding SHA1 digest of a script that actually exists in the script cache, true is returned, otherwise false is returned.
 
 
- 
scriptFlush
boolean scriptFlush()
From http://redis.io/commands/script-flush:
Available since 2.6.0.
Time complexity: O(N) with N being the number of scripts in cache
Flush the Lua scripts cache.
- Returns:
 - always true.
 
 
- 
scriptKill
boolean scriptKill(String hash)
From http://redis.io/commands/script-kill:
Available since 2.6.0.
Time complexity: O(1)
Kills the currently executing Lua script, assuming no write operation was yet performed by the script.
- Returns:
 - always true.
 
 
- 
scriptLoad
String scriptLoad(String content)
From http://redis.io/commands/script-load:
Available since 2.6.0.
Time complexity: O(N) with N being the length in bytes of the script body.
Load a script into the scripts cache, without executing it. After the specified command is loaded into the script cache it will be callable using
evalsha(String, String[], Object...)with the correct SHA1 digest of the script, exactly like after the first successful invocation ofeval(String, String[], Object...).- Returns:
 - the SHA1 digest of the script added into the script cache.
 
 
- 
scriptLoad
String scriptLoad(File content) throws IOException
From http://redis.io/commands/script-load:
Available since 2.6.0.
Time complexity: O(N) with N being the length in bytes of the script body.
Load a script into the scripts cache from the specified file without executing it. After the specified command is loaded into the script cache it will be callable using
evalsha(String, String[], Object...)with the correct SHA1 digest of the script, exactly like after the first successful invocation ofeval(String, String[], Object...).- Returns:
 - the SHA1 digest of the script added into the script cache.
 - Throws:
 IOException
 
- 
scriptLoad
String scriptLoad(InputStream content) throws IOException
From http://redis.io/commands/script-load:
Available since 2.6.0.
Time complexity: O(N) with N being the length in bytes of the script body.
Load a script into the scripts cache from the specified input stream (until the end is reached) without executing it. The stream is not closed after read. After the specified command is loaded into the script cache it will be callable using
evalsha(String, String[], Object...)with the correct SHA1 digest of the script, exactly like after the first successful invocation ofeval(String, String[], Object...).- Returns:
 - the SHA1 digest of the script added into the script cache.
 - Throws:
 IOException
 
 - 
 
 -