public class LettuceConnection extends AbstractRedisConnection
RedisConnection implementation on top of Lettuce Redis client.RedisStringCommands.BitOperationRedisListCommands.PositionRedisZSetCommands.Aggregate, RedisZSetCommands.TupleRedisServerCommands.ShutdownOption| Constructor and Description |
|---|
LettuceConnection(long timeout,
com.lambdaworks.redis.RedisClient client)
Instantiates a new lettuce connection.
|
LettuceConnection(long timeout,
com.lambdaworks.redis.RedisClient client,
LettucePool pool)
Instantiates a new lettuce connection.
|
LettuceConnection(com.lambdaworks.redis.RedisAsyncConnection<byte[],byte[]> sharedConnection,
long timeout,
com.lambdaworks.redis.RedisClient client)
Instantiates a new lettuce connection.
|
LettuceConnection(com.lambdaworks.redis.RedisAsyncConnection<byte[],byte[]> sharedConnection,
long timeout,
com.lambdaworks.redis.RedisClient client,
LettucePool pool)
Instantiates a new lettuce connection.
|
| Modifier and Type | Method and Description |
|---|---|
Long |
append(byte[] key,
byte[] value)
Append a
value to key. |
void |
bgReWriteAof()
Start an Append Only File rewrite process on server.
|
void |
bgSave()
Start background saving of db on server.
|
void |
bgWriteAof()
Deprecated.
As of 1.3, use
bgReWriteAof(). |
Long |
bitCount(byte[] key)
Count the number of set bits (population counting) in value stored at
key. |
Long |
bitCount(byte[] key,
long begin,
long end)
Count the number of set bits (population counting) of value stored at
key between begin and
end. |
Long |
bitOp(RedisStringCommands.BitOperation op,
byte[] destination,
byte[]... keys)
Perform bitwise operations between strings.
|
List<byte[]> |
bLPop(int timeout,
byte[]... keys)
Removes and returns first element from lists stored at
keys (see: RedisListCommands.lPop(byte[])). |
List<byte[]> |
bRPop(int timeout,
byte[]... keys)
Removes and returns last element from lists stored at
keys (see: RedisListCommands.rPop(byte[])). |
byte[] |
bRPopLPush(int timeout,
byte[] srcKey,
byte[] dstKey)
Remove the last element from list at
srcKey, append it to dstKey and return its value (see
RedisListCommands.rPopLPush(byte[], byte[])). |
void |
close()
Closes (or quits) the connection.
|
List<Object> |
closePipeline()
Executes the commands in the pipeline and returns their result.
|
protected DataAccessException |
convertLettuceAccessException(Exception ex) |
Long |
dbSize()
Get the total number of available keys in currently selected database.
|
Long |
decr(byte[] key)
Decrement value of
key by 1. |
Long |
decrBy(byte[] key,
long value)
Increment value of
key by value. |
Long |
del(byte[]... keys)
Delete given
keys. |
void |
discard()
Discard all commands issued after
RedisTxCommands.multi(). |
byte[] |
dump(byte[] key)
Retrieve serialized version of the value stored at
key. |
byte[] |
echo(byte[] message)
Returns
message via server roundtrip. |
<T> T |
eval(byte[] script,
ReturnType returnType,
int numKeys,
byte[]... keysAndArgs)
Evaluate given
script. |
<T> T |
evalSha(String scriptSha1,
ReturnType returnType,
int numKeys,
byte[]... keysAndArgs)
Evaluate given
scriptSha. |
List<Object> |
exec()
Executes all queued commands in a transaction started with
RedisTxCommands.multi(). |
Object |
execute(String command,
byte[]... args)
'Native' or 'raw' execution of the given command along-side the given arguments.
|
Object |
execute(String command,
com.lambdaworks.redis.protocol.CommandOutput commandOutputTypeHint,
byte[]... args)
'Native' or 'raw' execution of the given command along-side the given arguments.
|
Boolean |
exists(byte[] key)
Determine if given
key exists. |
Boolean |
expire(byte[] key,
long seconds)
Set time to live for given
key in seconds. |
Boolean |
expireAt(byte[] key,
long unixTime)
Set the expiration for given
key as a UNIX timestamp. |
void |
flushAll()
Delete all all keys from all databases.
|
void |
flushDb()
Delete all keys of the currently selected database.
|
byte[] |
get(byte[] key)
Get the value of
key. |
Boolean |
getBit(byte[] key,
long offset)
Get the bit value at
offset of value at key. |
List<RedisClientInfo> |
getClientList()
Request information and statistics about connected clients.
|
String |
getClientName()
Returns the name of the current connection.
|
List<String> |
getConfig(String param)
Load configuration parameters for given
pattern from server. |
com.lambdaworks.redis.RedisAsyncConnection<byte[],byte[]> |
getNativeConnection()
Returns the native connection (the underlying library/driver object).
|
byte[] |
getRange(byte[] key,
long start,
long end)
Get a substring of value of
key between begin and end. |
byte[] |
getSet(byte[] key,
byte[] value)
Set value of
key and return its old value. |
Subscription |
getSubscription()
Returns the current subscription for this connection or null if the connection is not subscribed.
|
Long |
hDel(byte[] key,
byte[]... fields)
Delete given hash
fields. |
Boolean |
hExists(byte[] key,
byte[] field)
Determine if given hash
field exists. |
byte[] |
hGet(byte[] key,
byte[] field)
Get value for given
field from hash at key. |
Map<byte[],byte[]> |
hGetAll(byte[] key)
Get entire hash stored at
key. |
Double |
hIncrBy(byte[] key,
byte[] field,
double delta)
Increment
value of a hash field by the given delta. |
Long |
hIncrBy(byte[] key,
byte[] field,
long delta)
Increment
value of a hash field by the given delta. |
Set<byte[]> |
hKeys(byte[] key)
Get key set (fields) of hash at
key. |
Long |
hLen(byte[] key)
Get size of hash at
key. |
List<byte[]> |
hMGet(byte[] key,
byte[]... fields)
Get values for given
fields from hash at key. |
void |
hMSet(byte[] key,
Map<byte[],byte[]> tuple)
Set multiple hash fields to multiple values using data provided in
hashes |
Cursor<Map.Entry<byte[],byte[]>> |
hScan(byte[] key,
long cursorId,
ScanOptions options) |
Cursor<Map.Entry<byte[],byte[]>> |
hScan(byte[] key,
ScanOptions options)
Use a
Cursor to iterate over entries in hash at key. |
Boolean |
hSet(byte[] key,
byte[] field,
byte[] value)
Set the
value of a hash field. |
Boolean |
hSetNX(byte[] key,
byte[] field,
byte[] value)
Set the
value of a hash field only if field does not exist. |
List<byte[]> |
hVals(byte[] key)
Get entry set (values) of hash at
field. |
Long |
incr(byte[] key)
Increment value of
key by 1. |
Double |
incrBy(byte[] key,
double value)
Increment value of
key by value. |
Long |
incrBy(byte[] key,
long value)
Increment value of
key by value. |
Properties |
info()
Load default server information like
mempory
cpu utilization
replication
|
Properties |
info(String section)
Load server information for given
selection. |
boolean |
isClosed()
Indicates whether the underlying connection is closed or not.
|
boolean |
isPipelined()
Indicates whether the connection is currently pipelined or not.
|
boolean |
isQueueing()
Indicates whether the connection is in "queue"(or "MULTI") mode or not.
|
boolean |
isSubscribed()
Indicates whether the current connection is subscribed (to at least one channel) or not.
|
Set<byte[]> |
keys(byte[] pattern)
Find all keys matching the given
pattern. |
void |
killClient(String host,
int port)
<<<<<<< HEAD Closes a given client connection identified by ip:port.
|
Long |
lastSave()
Get time of last
RedisServerCommands.bgSave() operation in seconds. |
byte[] |
lIndex(byte[] key,
long index)
Get element at
index form list at key. |
Long |
lInsert(byte[] key,
RedisListCommands.Position where,
byte[] pivot,
byte[] value)
Insert
value RedisListCommands.Position.BEFORE or RedisListCommands.Position.AFTER existing pivot for key. |
Long |
lLen(byte[] key)
Get the size of list stored at
key. |
byte[] |
lPop(byte[] key)
Removes and returns first element in list stored at
key. |
Long |
lPush(byte[] key,
byte[]... values)
Prepend
values to key. |
Long |
lPushX(byte[] key,
byte[] value)
Prepend
values to key only if the list exits. |
List<byte[]> |
lRange(byte[] key,
long start,
long end)
Get elements between
begin and end from list at key. |
Long |
lRem(byte[] key,
long count,
byte[] value)
Removes the first
count occurrences of value from the list stored at key. |
void |
lSet(byte[] key,
long index,
byte[] value)
Set the
value list element at index. |
void |
lTrim(byte[] key,
long start,
long end)
Trim list at
key to elements between begin and end. |
List<byte[]> |
mGet(byte[]... keys)
Get the values of all given
keys. |
Boolean |
move(byte[] key,
int dbIndex)
Move given
key to database with index. |
void |
mSet(Map<byte[],byte[]> tuples)
Set multiple keys to multiple values using key-value pairs provided in
tuple. |
Boolean |
mSetNX(Map<byte[],byte[]> tuples)
Set multiple keys to multiple values using key-value pairs provided in
tuple only if the provided key does
not exist. |
void |
multi()
Mark the start of a transaction block.
|
void |
openPipeline()
Activates the pipeline mode for this connection.
|
Boolean |
persist(byte[] key)
Remove the expiration from given
key. |
Boolean |
pExpire(byte[] key,
long millis)
Set time to live for given
key in milliseconds. |
Boolean |
pExpireAt(byte[] key,
long unixTimeInMillis)
Set the expiration for given
key as a UNIX timestamp in milliseconds. |
String |
ping()
Test connection.
|
void |
pSetEx(byte[] key,
long milliseconds,
byte[] value)
pSetEx is not directly supported and therefore emulated via lua script. |
void |
pSubscribe(MessageListener listener,
byte[]... patterns)
Subscribes the connection to all channels matching the given patterns.
|
Long |
pTtl(byte[] key)
Get the time to live for
key in milliseconds. |
Long |
publish(byte[] channel,
byte[] message)
Publishes the given message to the given channel.
|
byte[] |
randomKey()
Return a random key from the keyspace.
|
void |
rename(byte[] oldName,
byte[] newName)
Rename key
oleName to newName. |
Boolean |
renameNX(byte[] oldName,
byte[] newName)
Rename key
oleName to newName only if newName does not exist. |
void |
resetConfigStats()
Reset statistic counters on server.
|
void |
restore(byte[] key,
long ttlInMillis,
byte[] serializedValue)
|
byte[] |
rPop(byte[] key)
Removes and returns last element in list stored at
key. |
byte[] |
rPopLPush(byte[] srcKey,
byte[] dstKey)
Remove the last element from list at
srcKey, append it to dstKey and return its value. |
Long |
rPush(byte[] key,
byte[]... values)
Append
values to key. |
Long |
rPushX(byte[] key,
byte[] value)
Append
values to key only if the list exists. |
Long |
sAdd(byte[] key,
byte[]... values)
Add given
values to set at key. |
void |
save()
Synchronous save current db snapshot on server.
|
Cursor<byte[]> |
scan() |
Cursor<byte[]> |
scan(long cursorId,
ScanOptions options) |
Cursor<byte[]> |
scan(ScanOptions options)
Use a
Cursor to iterate over keys. |
Long |
sCard(byte[] key)
Get size of set at
key. |
List<Boolean> |
scriptExists(String... scriptSha1)
Check if given
scriptShas exist in script cache. |
void |
scriptFlush()
Flush lua script cache.
|
void |
scriptKill()
Kill current lua script execution.
|
String |
scriptLoad(byte[] script)
Load lua script into scripts cache, without executing it.
|
Set<byte[]> |
sDiff(byte[]... keys)
Diff all sets for given
keys. |
Long |
sDiffStore(byte[] destKey,
byte[]... keys)
Diff all sets for given
keys and store result in destKey |
void |
select(int dbIndex)
Select the DB with given positive
dbIndex. |
void |
set(byte[] key,
byte[] value)
Set
value for key. |
Boolean |
setBit(byte[] key,
long offset,
boolean value)
Sets the bit at
offset in value stored at key. |
void |
setClientName(byte[] name)
Assign given name to current connection.
|
void |
setConfig(String param,
String value)
Set server configuration for
key to value. |
void |
setConvertPipelineAndTxResults(boolean convertPipelineAndTxResults)
Specifies if pipelined and transaction results should be converted to the expected data type.
|
void |
setEx(byte[] key,
long time,
byte[] value)
Set the
value and expiration in seconds for key. |
Boolean |
setNX(byte[] key,
byte[] value)
Set
value for key, only if key does not exist. |
void |
setRange(byte[] key,
byte[] value,
long start)
Overwrite parts of
key starting at the specified offset with given value. |
void |
shutdown()
Shutdown server.
|
void |
shutdown(RedisServerCommands.ShutdownOption option)
Shutdown server.
|
Set<byte[]> |
sInter(byte[]... keys)
Returns the members intersecting all given sets at
keys. |
Long |
sInterStore(byte[] destKey,
byte[]... keys)
Intersect all given sets at
keys and store result in destKey. |
Boolean |
sIsMember(byte[] key,
byte[] value)
Check if set at
key contains value. |
void |
slaveOf(String host,
int port)
Change redis replication setting to new master.
|
void |
slaveOfNoOne()
Change server into master.
|
Set<byte[]> |
sMembers(byte[] key)
Get all elements of set at
key. |
Boolean |
sMove(byte[] srcKey,
byte[] destKey,
byte[] value)
Move
value from srcKey to |
List<byte[]> |
sort(byte[] key,
SortParameters params)
Sort the elements for
key. |
Long |
sort(byte[] key,
SortParameters params,
byte[] sortKey)
Sort the elements for
key and store result in storeKey. |
byte[] |
sPop(byte[] key)
Remove and return a random member from set at
key. |
byte[] |
sRandMember(byte[] key)
Get random element from set at
key. |
List<byte[]> |
sRandMember(byte[] key,
long count)
Get
count random elements from set at key. |
Long |
sRem(byte[] key,
byte[]... values)
Remove given
values from set at key and return the number of removed elements. |
Cursor<byte[]> |
sScan(byte[] key,
long cursorId,
ScanOptions options) |
Cursor<byte[]> |
sScan(byte[] key,
ScanOptions options)
Use a
Cursor to iterate over elements in set at key. |
Long |
strLen(byte[] key)
Get the length of the value stored at
key. |
void |
subscribe(MessageListener listener,
byte[]... channels)
Subscribes the connection to the given channels.
|
Set<byte[]> |
sUnion(byte[]... keys)
Union all sets at given
keys. |
Long |
sUnionStore(byte[] destKey,
byte[]... keys)
Union all sets at given
keys and store result in destKey. |
Long |
time()
Request server timestamp using
TIME command. |
Long |
ttl(byte[] key)
Get the time to live for
key in seconds. |
DataType |
type(byte[] key)
Determine the type stored at
key. |
void |
unwatch()
Flushes all the previously
#watch(byte[]) keys. |
void |
watch(byte[]... keys)
Watch given
keys for modifications during transaction started with RedisTxCommands.multi(). |
Boolean |
zAdd(byte[] key,
double score,
byte[] value)
Add
value to a sorted set at key, or update its score if it already exists. |
Long |
zAdd(byte[] key,
Set<RedisZSetCommands.Tuple> tuples)
Add
tuples to a sorted set at key, or update its score if it already exists. |
Long |
zCard(byte[] key)
Get the size of sorted set with
key. |
Long |
zCount(byte[] key,
double min,
double max)
Count number of elements within sorted set with scores between
min and max. |
Double |
zIncrBy(byte[] key,
double increment,
byte[] value)
Increment the score of element with
value in sorted set by increment. |
Long |
zInterStore(byte[] destKey,
byte[]... sets)
Intersect sorted
sets and store result in destination key. |
Long |
zInterStore(byte[] destKey,
RedisZSetCommands.Aggregate aggregate,
int[] weights,
byte[]... sets)
Intersect sorted
sets and store result in destination key. |
Set<byte[]> |
zRange(byte[] key,
long start,
long end)
Get elements between
begin and end from sorted set. |
Set<byte[]> |
zRangeByScore(byte[] key,
double min,
double max)
Get elements where score is between
min and max from sorted set. |
Set<byte[]> |
zRangeByScore(byte[] key,
double min,
double max,
long offset,
long count)
Get elements in range from
begin to end where score is between min and max from
sorted set. |
Set<RedisZSetCommands.Tuple> |
zRangeByScoreWithScores(byte[] key,
double min,
double max)
|
Set<RedisZSetCommands.Tuple> |
zRangeByScoreWithScores(byte[] key,
double min,
double max,
long offset,
long count)
Get set of
RedisZSetCommands.Tuples in range from begin to end where score is between min and
max from sorted set. |
Set<RedisZSetCommands.Tuple> |
zRangeWithScores(byte[] key,
long start,
long end)
|
Long |
zRank(byte[] key,
byte[] value)
Determine the index of element with
value in a sorted set. |
Long |
zRem(byte[] key,
byte[]... values)
Remove
values from sorted set. |
Long |
zRemRange(byte[] key,
long start,
long end)
Remove elements in range between
begin and end from sorted set with key. |
Long |
zRemRangeByScore(byte[] key,
double min,
double max)
Remove elements with scores between
min and max from sorted set with key. |
Set<byte[]> |
zRevRange(byte[] key,
long start,
long end)
Get elements in range from
begin to end from sorted set ordered high -> low. |
Set<byte[]> |
zRevRangeByScore(byte[] key,
double min,
double max)
Get elements where score is between
min and max from sorted set ordered high -> low. |
Set<byte[]> |
zRevRangeByScore(byte[] key,
double min,
double max,
long offset,
long count)
Get elements in range from
begin to end where score is between min and max from
sorted set ordered high -> low. |
Set<RedisZSetCommands.Tuple> |
zRevRangeByScoreWithScores(byte[] key,
double min,
double max)
Get set of
RedisZSetCommands.Tuple where score is between min and max from sorted set ordered high -> low. |
Set<RedisZSetCommands.Tuple> |
zRevRangeByScoreWithScores(byte[] key,
double min,
double max,
long offset,
long count)
Get set of
RedisZSetCommands.Tuple in range from begin to end where score is between min and
max from sorted set ordered high -> low. |
Set<RedisZSetCommands.Tuple> |
zRevRangeWithScores(byte[] key,
long start,
long end)
|
Long |
zRevRank(byte[] key,
byte[] value)
Determine the index of element with
value in a sorted set when scored high to low. |
Cursor<RedisZSetCommands.Tuple> |
zScan(byte[] key,
long cursorId,
ScanOptions options) |
Cursor<RedisZSetCommands.Tuple> |
zScan(byte[] key,
ScanOptions options)
Use a
Cursor to iterate over elements in sorted set at key. |
Double |
zScore(byte[] key,
byte[] value)
Get the score of element with
value from sorted set with key key. |
Long |
zUnionStore(byte[] destKey,
byte[]... sets)
Union sorted
sets and store result in destination key. |
Long |
zUnionStore(byte[] destKey,
RedisZSetCommands.Aggregate aggregate,
int[] weights,
byte[]... sets)
Union sorted
sets and store result in destination key. |
getSentinelConnection, getSentinelConnection, hasRedisSentinelConfigured, isActive, setSentinelConfigurationpublic LettuceConnection(long timeout,
com.lambdaworks.redis.RedisClient client)
timeout - The connection timeout (in milliseconds)client - The RedisClient to use when instantiating a native connectionpublic LettuceConnection(long timeout,
com.lambdaworks.redis.RedisClient client,
LettucePool pool)
timeout - The connection timeout (in milliseconds) * @param client The RedisClient to use when
instantiating a pub/sub connectionpool - The connection pool to use for all other native connectionspublic LettuceConnection(com.lambdaworks.redis.RedisAsyncConnection<byte[],byte[]> sharedConnection,
long timeout,
com.lambdaworks.redis.RedisClient client)
sharedConnection - A native connection that is shared with other LettuceConnections. Will not be used
for transactions or blocking operationstimeout - The connection timeout (in milliseconds)client - The RedisClient to use when making pub/sub, blocking, and tx connectionspublic LettuceConnection(com.lambdaworks.redis.RedisAsyncConnection<byte[],byte[]> sharedConnection,
long timeout,
com.lambdaworks.redis.RedisClient client,
LettucePool pool)
sharedConnection - A native connection that is shared with other LettuceConnections. Should not be
used for transactions or blocking operationstimeout - The connection timeout (in milliseconds)client - The RedisClient to use when making pub/sub connectionspool - The connection pool to use for blocking and tx operationsprotected DataAccessException convertLettuceAccessException(Exception ex)
public Object execute(String command, byte[]... args)
RedisCommandscommand - Command to executeargs - Possible command arguments (may be null)public Object execute(String command, com.lambdaworks.redis.protocol.CommandOutput commandOutputTypeHint, byte[]... args)
command - Command to executecommandOutputTypeHint - Type of Output to use, may be (may be null).args - Possible command arguments (may be null)RedisCommands#execute(String, byte[]...)public void close()
throws DataAccessException
RedisConnectionclose in interface RedisConnectionclose in class AbstractRedisConnectionDataAccessExceptionpublic boolean isClosed()
RedisConnectionpublic com.lambdaworks.redis.RedisAsyncConnection<byte[],byte[]> getNativeConnection()
RedisConnectionpublic boolean isQueueing()
RedisConnectionpublic boolean isPipelined()
RedisConnectionRedisConnection.openPipeline(),
RedisConnection.isQueueing()public void openPipeline()
RedisConnectionRedisConnection.closePipeline(). Calling this method when the connection is already pipelined has no effect.
Pipelining is used for issuing commands without requesting the response right away but rather at the end of the
batch. While somewhat similar to MULTI, pipelining does not guarantee atomicity - it only tries to improve
performance when issuing a lot of commands (such as in batching scenarios).
Note:
Consider doing some performance testing before using this feature since in many cases the performance benefits are minimal yet the impact on usage are not.RedisTxCommands.multi()public List<Object> closePipeline()
RedisConnectionpublic List<byte[]> sort(byte[] key, SortParameters params)
RedisKeyCommandskey.http://redis.io/commands/sortpublic Long sort(byte[] key, SortParameters params, byte[] sortKey)
RedisKeyCommandskey and store result in storeKey.http://redis.io/commands/sortpublic Long dbSize()
RedisServerCommandshttp://redis.io/commands/dbsizepublic void flushDb()
RedisServerCommandshttp://redis.io/commands/flushdbpublic void flushAll()
RedisServerCommandshttp://redis.io/commands/flushallpublic void bgSave()
RedisServerCommandshttp://redis.io/commands/bgsavepublic void bgReWriteAof()
RedisServerCommandshttp://redis.io/commands/bgrewriteaof@Deprecated public void bgWriteAof()
bgReWriteAof().RedisServerCommandshttp://redis.io/commands/bgrewriteaofpublic void save()
RedisServerCommandshttp://redis.io/commands/savepublic List<String> getConfig(String param)
RedisServerCommandspattern from server.http://redis.io/commands/config-getpublic Properties info()
RedisServerCommandshttp://redis.io/commands/infopublic Properties info(String section)
RedisServerCommandsselection.http://redis.io/commands/infopublic Long lastSave()
RedisServerCommandsRedisServerCommands.bgSave() operation in seconds.http://redis.io/commands/lastsavepublic void setConfig(String param, String value)
RedisServerCommandskey to value.http://redis.io/commands/config-setpublic void resetConfigStats()
RedisServerCommandsRedisServerCommands.info().http://redis.io/commands/config-resetstatpublic void shutdown()
RedisServerCommandshttp://redis.io/commands/shutdownpublic void shutdown(RedisServerCommands.ShutdownOption option)
RedisServerCommandshttp://redis.io/commands/shutdownpublic byte[] echo(byte[] message)
RedisConnectionCommandsmessage via server roundtrip.http://redis.io/commands/echopublic String ping()
RedisConnectionCommandshttp://redis.io/commands/pingpublic Long del(byte[]... keys)
RedisKeyCommandskeys.http://redis.io/commands/delpublic void discard()
RedisTxCommandsRedisTxCommands.multi().http://redis.io/commands/discardpublic List<Object> exec()
RedisTxCommandsRedisTxCommands.multi(). #watch(byte[]) the operation will fail if any of watched keys has been modified.http://redis.io/commands/execpublic Boolean exists(byte[] key)
RedisKeyCommandskey exists.http://redis.io/commands/existspublic Boolean expire(byte[] key, long seconds)
RedisKeyCommandskey in seconds.http://redis.io/commands/expirepublic Boolean expireAt(byte[] key, long unixTime)
RedisKeyCommandskey as a UNIX timestamp.http://redis.io/commands/expireatpublic Boolean pExpire(byte[] key, long millis)
RedisKeyCommandskey in milliseconds.http://redis.io/commands/pexpirepublic Boolean pExpireAt(byte[] key, long unixTimeInMillis)
RedisKeyCommandskey as a UNIX timestamp in milliseconds.http://redis.io/commands/pexpireatpublic Long pTtl(byte[] key)
RedisKeyCommandskey in milliseconds.http://redis.io/commands/pttlpublic byte[] dump(byte[] key)
RedisKeyCommandskey.http://redis.io/commands/dumppublic void restore(byte[] key,
long ttlInMillis,
byte[] serializedValue)
RedisKeyCommandshttp://redis.io/commands/restorepublic Set<byte[]> keys(byte[] pattern)
RedisKeyCommandspattern.http://redis.io/commands/keyspublic void multi()
RedisTxCommandsRedisTxCommands.exec() or rolled back using RedisTxCommands.discard()
.http://redis.io/commands/multipublic Boolean persist(byte[] key)
RedisKeyCommandskey.http://redis.io/commands/persistpublic Boolean move(byte[] key, int dbIndex)
RedisKeyCommandskey to database with index.http://redis.io/commands/movepublic byte[] randomKey()
RedisKeyCommandshttp://redis.io/commands/randomkeypublic void rename(byte[] oldName,
byte[] newName)
RedisKeyCommandsoleName to newName.http://redis.io/commands/renamepublic Boolean renameNX(byte[] oldName, byte[] newName)
RedisKeyCommandsoleName to newName only if newName does not exist.http://redis.io/commands/renamenxpublic void select(int dbIndex)
RedisConnectionCommandsdbIndex.http://redis.io/commands/selectpublic Long ttl(byte[] key)
RedisKeyCommandskey in seconds.http://redis.io/commands/ttlpublic DataType type(byte[] key)
RedisKeyCommandskey.http://redis.io/commands/typepublic void unwatch()
RedisTxCommands#watch(byte[]) keys.http://redis.io/commands/unwatchpublic void watch(byte[]... keys)
RedisTxCommandskeys for modifications during transaction started with RedisTxCommands.multi().http://redis.io/commands/watchpublic byte[] get(byte[] key)
RedisStringCommandskey.http://redis.io/commands/getpublic void set(byte[] key,
byte[] value)
RedisStringCommandsvalue for key.http://redis.io/commands/setpublic byte[] getSet(byte[] key,
byte[] value)
RedisStringCommandskey and return its old value.http://redis.io/commands/getsetpublic Long append(byte[] key, byte[] value)
RedisStringCommandsvalue to key.http://redis.io/commands/appendpublic List<byte[]> mGet(byte[]... keys)
RedisStringCommandskeys.http://redis.io/commands/mgetpublic void mSet(Map<byte[],byte[]> tuples)
RedisStringCommandstuple.http://redis.io/commands/msetpublic Boolean mSetNX(Map<byte[],byte[]> tuples)
RedisStringCommandstuple only if the provided key does
not exist.http://redis.io/commands/msetnxpublic void setEx(byte[] key,
long time,
byte[] value)
RedisStringCommandsvalue and expiration in seconds for key.http://redis.io/commands/setexpublic void pSetEx(byte[] key,
long milliseconds,
byte[] value)
pSetEx is not directly supported and therefore emulated via lua script.RedisStringCommands.pSetEx(byte[], long, byte[])public Boolean setNX(byte[] key, byte[] value)
RedisStringCommandsvalue for key, only if key does not exist.http://redis.io/commands/setnxpublic byte[] getRange(byte[] key,
long start,
long end)
RedisStringCommandskey between begin and end.http://redis.io/commands/getrangepublic Long decr(byte[] key)
RedisStringCommandskey by 1.http://redis.io/commands/decrpublic Long decrBy(byte[] key, long value)
RedisStringCommandskey by value.http://redis.io/commands/decrbypublic Long incr(byte[] key)
RedisStringCommandskey by 1.http://redis.io/commands/incrpublic Long incrBy(byte[] key, long value)
RedisStringCommandskey by value.http://redis.io/commands/incrbypublic Double incrBy(byte[] key, double value)
RedisStringCommandskey by value.http://redis.io/commands/incrbyfloatpublic Boolean getBit(byte[] key, long offset)
RedisStringCommandsoffset of value at key.http://redis.io/commands/getbitpublic Boolean setBit(byte[] key, long offset, boolean value)
RedisStringCommandsoffset in value stored at key.offset.http://redis.io/commands/setbitpublic void setRange(byte[] key,
byte[] value,
long start)
RedisStringCommandskey starting at the specified offset with given value.http://redis.io/commands/setrangepublic Long strLen(byte[] key)
RedisStringCommandskey.http://redis.io/commands/strlenpublic Long bitCount(byte[] key)
RedisStringCommandskey.http://redis.io/commands/bitcountpublic Long bitCount(byte[] key, long begin, long end)
RedisStringCommandskey between begin and
end.http://redis.io/commands/bitcountpublic Long bitOp(RedisStringCommands.BitOperation op, byte[] destination, byte[]... keys)
RedisStringCommandshttp://redis.io/commands/bitoppublic Long lPush(byte[] key, byte[]... values)
RedisListCommandsvalues to key.http://redis.io/commands/lpushpublic Long rPush(byte[] key, byte[]... values)
RedisListCommandsvalues to key.http://redis.io/commands/rpushpublic List<byte[]> bLPop(int timeout, byte[]... keys)
RedisListCommandskeys (see: RedisListCommands.lPop(byte[])). timeout reached.http://redis.io/commands/blpoppublic List<byte[]> bRPop(int timeout, byte[]... keys)
RedisListCommandskeys (see: RedisListCommands.rPop(byte[])). timeout reached.http://redis.io/commands/brpoppublic byte[] lIndex(byte[] key,
long index)
RedisListCommandsindex form list at key.http://redis.io/commands/lindexpublic Long lInsert(byte[] key, RedisListCommands.Position where, byte[] pivot, byte[] value)
RedisListCommandsvalue RedisListCommands.Position.BEFORE or RedisListCommands.Position.AFTER existing pivot for key.http://redis.io/commands/linsertpublic Long lLen(byte[] key)
RedisListCommandskey.http://redis.io/commands/llenpublic byte[] lPop(byte[] key)
RedisListCommandskey.http://redis.io/commands/lpoppublic List<byte[]> lRange(byte[] key, long start, long end)
RedisListCommandsbegin and end from list at key.http://redis.io/commands/lrangepublic Long lRem(byte[] key, long count, byte[] value)
RedisListCommandscount occurrences of value from the list stored at key.http://redis.io/commands/lrempublic void lSet(byte[] key,
long index,
byte[] value)
RedisListCommandsvalue list element at index.http://redis.io/commands/lsetpublic void lTrim(byte[] key,
long start,
long end)
RedisListCommandskey to elements between begin and end.http://redis.io/commands/ltrimpublic byte[] rPop(byte[] key)
RedisListCommandskey.http://redis.io/commands/rpoppublic byte[] rPopLPush(byte[] srcKey,
byte[] dstKey)
RedisListCommandssrcKey, append it to dstKey and return its value.http://redis.io/commands/rpoplpushpublic byte[] bRPopLPush(int timeout,
byte[] srcKey,
byte[] dstKey)
RedisListCommandssrcKey, append it to dstKey and return its value (see
RedisListCommands.rPopLPush(byte[], byte[])). timeout reached.http://redis.io/commands/brpoplpushpublic Long lPushX(byte[] key, byte[] value)
RedisListCommandsvalues to key only if the list exits.http://redis.io/commands/lpushxpublic Long rPushX(byte[] key, byte[] value)
RedisListCommands values to key only if the list exists.http://redis.io/commands/rpushxpublic Long sAdd(byte[] key, byte[]... values)
RedisSetCommandsvalues to set at key.http://redis.io/commands/saddpublic Long sCard(byte[] key)
RedisSetCommandskey.http://redis.io/commands/scardpublic Set<byte[]> sDiff(byte[]... keys)
RedisSetCommandskeys.http://redis.io/commands/sdiffpublic Long sDiffStore(byte[] destKey, byte[]... keys)
RedisSetCommandskeys and store result in destKeyhttp://redis.io/commands/sdiffstorepublic Set<byte[]> sInter(byte[]... keys)
RedisSetCommandskeys.http://redis.io/commands/sinterpublic Long sInterStore(byte[] destKey, byte[]... keys)
RedisSetCommandskeys and store result in destKey.http://redis.io/commands/sinterstorepublic Boolean sIsMember(byte[] key, byte[] value)
RedisSetCommandskey contains value.http://redis.io/commands/sismemberpublic Set<byte[]> sMembers(byte[] key)
RedisSetCommandskey.http://redis.io/commands/smemberspublic Boolean sMove(byte[] srcKey, byte[] destKey, byte[] value)
RedisSetCommandsvalue from srcKey to http://redis.io/commands/smovepublic byte[] sPop(byte[] key)
RedisSetCommandskey.http://redis.io/commands/spoppublic byte[] sRandMember(byte[] key)
RedisSetCommandskey.http://redis.io/commands/srandmemberpublic List<byte[]> sRandMember(byte[] key, long count)
RedisSetCommandscount random elements from set at key.http://redis.io/commands/srandmemberpublic Long sRem(byte[] key, byte[]... values)
RedisSetCommandsvalues from set at key and return the number of removed elements.http://redis.io/commands/srempublic Set<byte[]> sUnion(byte[]... keys)
RedisSetCommandskeys.http://redis.io/commands/sunionpublic Long sUnionStore(byte[] destKey, byte[]... keys)
RedisSetCommandskeys and store result in destKey.http://redis.io/commands/sunionstorepublic Boolean zAdd(byte[] key, double score, byte[] value)
RedisZSetCommandsvalue to a sorted set at key, or update its score if it already exists.http://redis.io/commands/zaddpublic Long zAdd(byte[] key, Set<RedisZSetCommands.Tuple> tuples)
RedisZSetCommandstuples to a sorted set at key, or update its score if it already exists.http://redis.io/commands/zaddpublic Long zCard(byte[] key)
RedisZSetCommandskey.http://redis.io/commands/zcardpublic Long zCount(byte[] key, double min, double max)
RedisZSetCommandsmin and max.http://redis.io/commands/zcountpublic Double zIncrBy(byte[] key, double increment, byte[] value)
RedisZSetCommandsvalue in sorted set by increment.http://redis.io/commands/zincrbypublic Long zInterStore(byte[] destKey, RedisZSetCommands.Aggregate aggregate, int[] weights, byte[]... sets)
RedisZSetCommandssets and store result in destination key.http://redis.io/commands/zinterstorepublic Long zInterStore(byte[] destKey, byte[]... sets)
RedisZSetCommandssets and store result in destination key.http://redis.io/commands/zinterstorepublic Set<byte[]> zRange(byte[] key, long start, long end)
RedisZSetCommandsbegin and end from sorted set.http://redis.io/commands/zrangepublic Set<RedisZSetCommands.Tuple> zRangeWithScores(byte[] key, long start, long end)
RedisZSetCommandshttp://redis.io/commands/zrangepublic Set<byte[]> zRangeByScore(byte[] key, double min, double max)
RedisZSetCommandsmin and max from sorted set.http://redis.io/commands/zrangebyscorepublic Set<RedisZSetCommands.Tuple> zRangeByScoreWithScores(byte[] key, double min, double max)
RedisZSetCommandshttp://redis.io/commands/zrangebyscorepublic Set<RedisZSetCommands.Tuple> zRevRangeWithScores(byte[] key, long start, long end)
RedisZSetCommandshttp://redis.io/commands/zrevrangepublic Set<byte[]> zRangeByScore(byte[] key, double min, double max, long offset, long count)
RedisZSetCommandsbegin to end where score is between min and max from
sorted set.http://redis.io/commands/zrangebyscorepublic Set<RedisZSetCommands.Tuple> zRangeByScoreWithScores(byte[] key, double min, double max, long offset, long count)
RedisZSetCommandsRedisZSetCommands.Tuples in range from begin to end where score is between min and
max from sorted set.http://redis.io/commands/zrangebyscorepublic Set<byte[]> zRevRangeByScore(byte[] key, double min, double max, long offset, long count)
RedisZSetCommandsbegin to end where score is between min and max from
sorted set ordered high -> low.http://redis.io/commands/zrevrangebyscorepublic Set<byte[]> zRevRangeByScore(byte[] key, double min, double max)
RedisZSetCommandsmin and max from sorted set ordered high -> low.http://redis.io/commands/zrevrangepublic Set<RedisZSetCommands.Tuple> zRevRangeByScoreWithScores(byte[] key, double min, double max, long offset, long count)
RedisZSetCommandsRedisZSetCommands.Tuple in range from begin to end where score is between min and
max from sorted set ordered high -> low.http://redis.io/commands/zrevrangebyscorepublic Set<RedisZSetCommands.Tuple> zRevRangeByScoreWithScores(byte[] key, double min, double max)
RedisZSetCommandsRedisZSetCommands.Tuple where score is between min and max from sorted set ordered high -> low.http://redis.io/commands/zrevrangepublic Long zRank(byte[] key, byte[] value)
RedisZSetCommandsvalue in a sorted set.http://redis.io/commands/zrankpublic Long zRem(byte[] key, byte[]... values)
RedisZSetCommandsvalues from sorted set. Return number of removed elements.http://redis.io/commands/zrempublic Long zRemRange(byte[] key, long start, long end)
RedisZSetCommandsbegin and end from sorted set with key.http://redis.io/commands/zremrangepublic Long zRemRangeByScore(byte[] key, double min, double max)
RedisZSetCommandsmin and max from sorted set with key.http://redis.io/commands/zremrangebyscorepublic Set<byte[]> zRevRange(byte[] key, long start, long end)
RedisZSetCommandsbegin to end from sorted set ordered high -> low.http://redis.io/commands/zrevrangepublic Long zRevRank(byte[] key, byte[] value)
RedisZSetCommandsvalue in a sorted set when scored high to low.http://redis.io/commands/zrevrankpublic Double zScore(byte[] key, byte[] value)
RedisZSetCommandsvalue from sorted set with key key.http://redis.io/commands/zrempublic Long zUnionStore(byte[] destKey, RedisZSetCommands.Aggregate aggregate, int[] weights, byte[]... sets)
RedisZSetCommandssets and store result in destination key.http://redis.io/commands/zunionstorepublic Long zUnionStore(byte[] destKey, byte[]... sets)
RedisZSetCommandssets and store result in destination key.http://redis.io/commands/zunionstorepublic Boolean hSet(byte[] key, byte[] field, byte[] value)
RedisHashCommandsvalue of a hash field.http://redis.io/commands/hsetpublic Boolean hSetNX(byte[] key, byte[] field, byte[] value)
RedisHashCommandsvalue of a hash field only if field does not exist.http://redis.io/commands/hsetnxpublic Long hDel(byte[] key, byte[]... fields)
RedisHashCommandsfields.http://redis.io/commands/hdelpublic Boolean hExists(byte[] key, byte[] field)
RedisHashCommandsfield exists.http://redis.io/commands/hexitspublic byte[] hGet(byte[] key,
byte[] field)
RedisHashCommandsfield from hash at key.http://redis.io/commands/hgetpublic Map<byte[],byte[]> hGetAll(byte[] key)
RedisHashCommandskey.http://redis.io/commands/hgetallpublic Long hIncrBy(byte[] key, byte[] field, long delta)
RedisHashCommandsvalue of a hash field by the given delta.http://redis.io/commands/hincrbypublic Double hIncrBy(byte[] key, byte[] field, double delta)
RedisHashCommandsvalue of a hash field by the given delta.http://redis.io/commands/hincrbyfloatpublic Set<byte[]> hKeys(byte[] key)
RedisHashCommandskey.http://redis.io/commands/h?public Long hLen(byte[] key)
RedisHashCommandskey.http://redis.io/commands/hlenpublic List<byte[]> hMGet(byte[] key, byte[]... fields)
RedisHashCommandsfields from hash at key.http://redis.io/commands/hmgetpublic void hMSet(byte[] key,
Map<byte[],byte[]> tuple)
RedisHashCommandshasheshttp://redis.io/commands/hmsetpublic List<byte[]> hVals(byte[] key)
RedisHashCommandsfield.http://redis.io/commands/hvalspublic void scriptFlush()
RedisScriptingCommandshttp://redis.io/commands/script-flushpublic void scriptKill()
RedisScriptingCommandshttp://redis.io/commands/script-killpublic String scriptLoad(byte[] script)
RedisScriptingCommands#evalSha(String, ReturnType, int, byte[]).http://redis.io/commands/script-loadpublic List<Boolean> scriptExists(String... scriptSha1)
RedisScriptingCommandsscriptShas exist in script cache.http://redis.io/commands/script-exitspublic <T> T eval(byte[] script,
ReturnType returnType,
int numKeys,
byte[]... keysAndArgs)
RedisScriptingCommandsscript.http://redis.io/commands/evalpublic <T> T evalSha(String scriptSha1, ReturnType returnType, int numKeys, byte[]... keysAndArgs)
RedisScriptingCommandsscriptSha.http://redis.io/commands/evalshapublic Long publish(byte[] channel, byte[] message)
RedisPubSubCommandschannel - the channel to publish tomessage - message to publishpublic Subscription getSubscription()
RedisPubSubCommandspublic boolean isSubscribed()
RedisPubSubCommandspublic void pSubscribe(MessageListener listener, byte[]... patterns)
RedisPubSubCommandslistener - message listenerpatterns - channel name patternspublic void subscribe(MessageListener listener, byte[]... channels)
RedisPubSubCommandslistener - message listenerchannels - channel namespublic Long time()
RedisServerCommandsTIME command.public void killClient(String host, int port)
RedisServerCommandshost - of connection to close.port - of connection to closepublic void setClientName(byte[] name)
RedisServerCommandspublic void slaveOf(String host, int port)
RedisServerCommandshttp://redis.io/commands/slaveofpublic String getClientName()
RedisServerCommandshttp://redis.io/commands/client-getnamepublic List<RedisClientInfo> getClientList()
RedisServerCommandsList of RedisClientInfo objects.http://redis.io/commands/client-listpublic void slaveOfNoOne()
RedisServerCommandshttp://redis.io/commands/slaveofpublic Cursor<byte[]> scan()
public Cursor<byte[]> scan(ScanOptions options)
RedisKeyCommandsCursor to iterate over keys. http://redis.io/commands/scanpublic Cursor<byte[]> scan(long cursorId, ScanOptions options)
cursorId - options - public Cursor<Map.Entry<byte[],byte[]>> hScan(byte[] key, ScanOptions options)
RedisHashCommandsCursor to iterate over entries in hash at key.http://redis.io/commands/scanpublic Cursor<Map.Entry<byte[],byte[]>> hScan(byte[] key, long cursorId, ScanOptions options)
key - cursorId - options - public Cursor<byte[]> sScan(byte[] key, ScanOptions options)
RedisSetCommandsCursor to iterate over elements in set at key.http://redis.io/commands/scanpublic Cursor<byte[]> sScan(byte[] key, long cursorId, ScanOptions options)
key - cursorId - options - public Cursor<RedisZSetCommands.Tuple> zScan(byte[] key, ScanOptions options)
RedisZSetCommandsCursor to iterate over elements in sorted set at key.http://redis.io/commands/scanpublic Cursor<RedisZSetCommands.Tuple> zScan(byte[] key, long cursorId, ScanOptions options)
key - cursorId - options - public void setConvertPipelineAndTxResults(boolean convertPipelineAndTxResults)
closePipeline() and exec() will be of the type returned by the Lettuce driverconvertPipelineAndTxResults - Whether or not to convert pipeline and tx results