public class JedisConnection extends AbstractRedisConnection
RedisConnection
implementation on top of Jedis library.RedisStringCommands.BitOperation, RedisStringCommands.SetOption
RedisListCommands.Position
RedisZSetCommands.Aggregate, RedisZSetCommands.Limit, RedisZSetCommands.Range, RedisZSetCommands.Tuple
RedisServerCommands.MigrateOption, RedisServerCommands.ShutdownOption
RedisGeoCommands.DistanceUnit, RedisGeoCommands.GeoLocation<T>, RedisGeoCommands.GeoRadiusCommandArgs
Constructor and Description |
---|
JedisConnection(redis.clients.jedis.Jedis jedis)
Constructs a new
JedisConnection instance. |
JedisConnection(redis.clients.jedis.Jedis jedis,
redis.clients.util.Pool<redis.clients.jedis.Jedis> pool,
int dbIndex)
Constructs a new
JedisConnection instance backed by a jedis pool. |
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 |
convertJedisAccessException(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(byte[] scriptSha1,
ReturnType returnType,
int numKeys,
byte[]... keysAndArgs)
Evaluate given
scriptSha . |
<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.
|
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.
|
Long |
geoAdd(byte[] key,
Iterable<RedisGeoCommands.GeoLocation<byte[]>> locations)
Add
RedisGeoCommands.GeoLocation s to key |
Long |
geoAdd(byte[] key,
Map<byte[],Point> memberCoordinateMap)
|
Long |
geoAdd(byte[] key,
Point point,
byte[] member)
Add
Point with given member name to key. |
Long |
geoAdd(byte[] key,
RedisGeoCommands.GeoLocation<byte[]> location)
Add
RedisGeoCommands.GeoLocation to key. |
Distance |
geoDist(byte[] key,
byte[] member1,
byte[] member2)
Get the
Distance between member1 and member2. |
Distance |
geoDist(byte[] key,
byte[] member1,
byte[] member2,
Metric metric)
|
List<String> |
geoHash(byte[] key,
byte[]... members)
Get Geohash representation of the position for one or more members.
|
List<Point> |
geoPos(byte[] key,
byte[]... members)
Get the
Point representation of positions for one or more members. |
GeoResults<RedisGeoCommands.GeoLocation<byte[]>> |
geoRadius(byte[] key,
Circle within)
Get the members within the boundaries of a given
Circle . |
GeoResults<RedisGeoCommands.GeoLocation<byte[]>> |
geoRadius(byte[] key,
Circle within,
RedisGeoCommands.GeoRadiusCommandArgs args)
Get the members within the boundaries of a given
Circle applying RedisGeoCommands.GeoRadiusCommandArgs . |
GeoResults<RedisGeoCommands.GeoLocation<byte[]>> |
geoRadiusByMember(byte[] key,
byte[] member,
Distance radius)
Get the members within the circle defined by the members coordinates and given
Distance . |
GeoResults<RedisGeoCommands.GeoLocation<byte[]>> |
geoRadiusByMember(byte[] key,
byte[] member,
Distance radius,
RedisGeoCommands.GeoRadiusCommandArgs args)
Get the members within the circle defined by the members coordinates, given
Distance
and RedisGeoCommands.GeoRadiusCommandArgs . |
GeoResults<RedisGeoCommands.GeoLocation<byte[]>> |
geoRadiusByMember(byte[] key,
byte[] member,
double radius)
Get the members within the circle defined by the members coordinates and given
radius.
|
Long |
geoRemove(byte[] key,
byte[]... members)
Remove the members.
|
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. |
protected redis.clients.jedis.Jedis |
getJedis(RedisNode node) |
redis.clients.jedis.Jedis |
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 . |
protected JedisSentinelConnection |
getSentinelConnection(RedisNode sentinel)
Get
RedisSentinelCommands connected to given node. |
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
See http://redis.io/commands/info
|
Properties |
info(String section)
Load server information for given
selection . |
protected boolean |
isActive(RedisNode node)
Check if node is active by sending ping.
|
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)
Closes a given client connection identified by host: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 exists. |
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 . |
void |
migrate(byte[] key,
RedisNode target,
int dbIndex,
RedisServerCommands.MigrateOption option) |
void |
migrate(byte[] key,
RedisNode target,
int dbIndex,
RedisServerCommands.MigrateOption option,
long timeout) |
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. |
Long |
pfAdd(byte[] key,
byte[]... values)
Adds given values to the HyperLogLog stored at given key.
|
Long |
pfCount(byte[]... keys)
Return the approximated cardinality of the structures observed by the HyperLogLog at key(s).
|
void |
pfMerge(byte[] destinationKey,
byte[]... sourceKeys)
Merge N different HyperLogLogs at sourceKeys into a single destinationKey.
|
String |
ping()
Test connection.
|
void |
pSetEx(byte[] key,
long milliseconds,
byte[] value)
Set the
value and expiration in milliseconds for key . |
void |
pSubscribe(MessageListener listener,
byte[]... patterns)
Subscribes the connection to all channels matching the given patterns.
|
Long |
pTtl(byte[] key)
Get the precise time to live for
key in milliseconds. |
Long |
pTtl(byte[] key,
TimeUnit timeUnit)
Get the precise time to live for
key in and convert it to the given TimeUnit . |
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
See http://redis.io/commands/sdiffstore |
void |
select(int dbIndex)
Select the DB with given positive
dbIndex . |
void |
set(byte[] key,
byte[] value)
Set
value for key . |
void |
set(byte[] key,
byte[] value,
Expiration expiration,
RedisStringCommands.SetOption option)
Set
value for key applying timeouts from expiration if set and inserting/updating values
depending on option . |
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
param to value . |
void |
setConvertPipelineAndTxResults(boolean convertPipelineAndTxResults)
Specifies if pipelined 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 destKey
See http://redis.io/commands/smove |
List<byte[]> |
sort(byte[] key,
SortParameters params)
Sort the elements for
key . |
Long |
sort(byte[] key,
SortParameters params,
byte[] storeKey)
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. |
Long |
ttl(byte[] key,
TimeUnit timeUnit)
Get the time to live for
key in and convert it to the given TimeUnit . |
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 . |
Long |
zCount(byte[] key,
RedisZSetCommands.Range range)
Count number of elements within sorted set with scores between
Range#min and Range#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[]> |
zRangeByLex(byte[] key)
Get all the elements in the sorted set at key in lexicographical ordering.
|
Set<byte[]> |
zRangeByLex(byte[] key,
RedisZSetCommands.Range range)
Get all the elements in
RedisZSetCommands.Range from the sorted set at key in lexicographical ordering. |
Set<byte[]> |
zRangeByLex(byte[] key,
RedisZSetCommands.Range range,
RedisZSetCommands.Limit limit)
Get all the elements in
RedisZSetCommands.Range from the sorted set at key in lexicographical ordering. |
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<byte[]> |
zRangeByScore(byte[] key,
RedisZSetCommands.Range range)
Get elements where score is between
Range#min and Range#max from sorted set. |
Set<byte[]> |
zRangeByScore(byte[] key,
RedisZSetCommands.Range range,
RedisZSetCommands.Limit limit)
Get elements in range from
Limit#count to Limit#offset where score is between Range#min and
Range#max from sorted set. |
Set<byte[]> |
zRangeByScore(byte[] key,
String min,
String max)
Get elements where score is between
min and max from sorted set. |
Set<byte[]> |
zRangeByScore(byte[] key,
String min,
String 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.Tuple s in range from begin to end where score is between min and
max from sorted set. |
Set<RedisZSetCommands.Tuple> |
zRangeByScoreWithScores(byte[] key,
RedisZSetCommands.Range range)
|
Set<RedisZSetCommands.Tuple> |
zRangeByScoreWithScores(byte[] key,
RedisZSetCommands.Range range,
RedisZSetCommands.Limit limit)
Get set of
RedisZSetCommands.Tuple s in range from Limit#offset to Limit#offset + Limit#count where score is
between Range#min and Range#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 . |
Long |
zRemRangeByScore(byte[] key,
RedisZSetCommands.Range range)
Remove elements with scores between
Range#min and Range#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 from high to low. |
Set<byte[]> |
zRevRangeByScore(byte[] key,
double min,
double max)
Get elements where score is between
min and max from sorted set ordered from high to 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<byte[]> |
zRevRangeByScore(byte[] key,
RedisZSetCommands.Range range)
Get elements where score is between
Range#min and Range#max from sorted set ordered from high to
low. |
Set<byte[]> |
zRevRangeByScore(byte[] key,
RedisZSetCommands.Range range,
RedisZSetCommands.Limit limit)
Get elements in range from
Limit#offset to Limit#offset + Limit#count where score is between
Range#min and Range#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 from high to
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> |
zRevRangeByScoreWithScores(byte[] key,
RedisZSetCommands.Range range)
Get set of
RedisZSetCommands.Tuple where score is between Range#min and Range#max from sorted set ordered
from high to low. |
Set<RedisZSetCommands.Tuple> |
zRevRangeByScoreWithScores(byte[] key,
RedisZSetCommands.Range range,
RedisZSetCommands.Limit limit)
Get set of
RedisZSetCommands.Tuple in range from Limit#offset to Limit#count where score is between
Range#min and Range#max from sorted set ordered high -> low. |
Set<RedisZSetCommands.Tuple> |
zRevRangeWithScores(byte[] key,
long start,
long end)
Get set of
RedisZSetCommands.Tuple s in range from begin to end from sorted set ordered from high to low. |
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, hasRedisSentinelConfigured, setSentinelConfiguration
public JedisConnection(redis.clients.jedis.Jedis jedis)
JedisConnection
instance.jedis
- Jedis entitypublic JedisConnection(redis.clients.jedis.Jedis jedis, redis.clients.util.Pool<redis.clients.jedis.Jedis> pool, int dbIndex)
JedisConnection
instance backed by a jedis pool.jedis
- pool
- can be null, if no pool is usedprotected DataAccessException convertJedisAccessException(Exception ex)
public Object execute(String command, byte[]... args)
RedisCommands
command
- Command to executeargs
- Possible command arguments (may be null)public void close() throws DataAccessException
RedisConnection
close
in interface RedisConnection
close
in class AbstractRedisConnection
DataAccessException
public redis.clients.jedis.Jedis getNativeConnection()
RedisConnection
public boolean isClosed()
RedisConnection
public boolean isQueueing()
RedisConnection
public boolean isPipelined()
RedisConnection
RedisConnection.openPipeline()
,
RedisConnection.isQueueing()
public void openPipeline()
RedisConnection
RedisConnection.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()
RedisConnection
public List<byte[]> sort(byte[] key, SortParameters params)
RedisKeyCommands
key
.
See http://redis.io/commands/sort
public Long sort(byte[] key, SortParameters params, byte[] storeKey)
RedisKeyCommands
key
and store result in storeKey
.
See http://redis.io/commands/sort
public Long dbSize()
RedisServerCommands
See http://redis.io/commands/dbsize
public void flushDb()
RedisServerCommands
See http://redis.io/commands/flushdb
public void flushAll()
RedisServerCommands
See http://redis.io/commands/flushall
public void bgSave()
RedisServerCommands
See http://redis.io/commands/bgsave
public void bgReWriteAof()
RedisServerCommands
See http://redis.io/commands/bgrewriteaof
@Deprecated public void bgWriteAof()
bgReWriteAof()
.RedisServerCommands
See http://redis.io/commands/bgrewriteaof
public void save()
RedisServerCommands
See http://redis.io/commands/save
public List<String> getConfig(String param)
RedisServerCommands
pattern
from server.
See http://redis.io/commands/config-get
public Properties info()
RedisServerCommands
See http://redis.io/commands/info
public Properties info(String section)
RedisServerCommands
selection
.
See http://redis.io/commands/info
public Long lastSave()
RedisServerCommands
RedisServerCommands.bgSave()
operation in seconds.
See http://redis.io/commands/lastsave
public void setConfig(String param, String value)
RedisServerCommands
param
to value
.
See http://redis.io/commands/config-set
public void resetConfigStats()
RedisServerCommands
RedisServerCommands.info()
.
See http://redis.io/commands/config-resetstat
public void shutdown()
RedisServerCommands
See http://redis.io/commands/shutdown
public void shutdown(RedisServerCommands.ShutdownOption option)
RedisServerCommands
See http://redis.io/commands/shutdown
public byte[] echo(byte[] message)
RedisConnectionCommands
message
via server roundtrip.
See http://redis.io/commands/echo
public String ping()
RedisConnectionCommands
See http://redis.io/commands/ping
public Long del(byte[]... keys)
RedisKeyCommands
keys
.
See http://redis.io/commands/del
public void discard()
RedisTxCommands
RedisTxCommands.multi()
.
See http://redis.io/commands/discard
public List<Object> exec()
RedisTxCommands
RedisTxCommands.multi()
. #watch(byte[])
the operation will fail if any of watched keys has been modified.
See http://redis.io/commands/exec
public Boolean exists(byte[] key)
RedisKeyCommands
key
exists.
See http://redis.io/commands/exists
public Boolean expire(byte[] key, long seconds)
RedisKeyCommands
key
in seconds.
See http://redis.io/commands/expire
public Boolean expireAt(byte[] key, long unixTime)
RedisKeyCommands
key
as a UNIX timestamp.
See http://redis.io/commands/expireat
public Set<byte[]> keys(byte[] pattern)
RedisKeyCommands
pattern
.
See http://redis.io/commands/keys
public void multi()
RedisTxCommands
RedisTxCommands.exec()
or rolled back using RedisTxCommands.discard()
See http://redis.io/commands/multi
public Boolean persist(byte[] key)
RedisKeyCommands
key
.
See http://redis.io/commands/persist
public Boolean move(byte[] key, int dbIndex)
RedisKeyCommands
key
to database with index
.
See http://redis.io/commands/move
public byte[] randomKey()
RedisKeyCommands
See http://redis.io/commands/randomkey
public void rename(byte[] oldName, byte[] newName)
RedisKeyCommands
oleName
to newName
.
See http://redis.io/commands/rename
public Boolean renameNX(byte[] oldName, byte[] newName)
RedisKeyCommands
oleName
to newName
only if newName
does not exist.
See http://redis.io/commands/renamenx
public void select(int dbIndex)
RedisConnectionCommands
dbIndex
.
See http://redis.io/commands/select
public Long ttl(byte[] key)
RedisKeyCommands
key
in seconds.
See http://redis.io/commands/ttl
public Long ttl(byte[] key, TimeUnit timeUnit)
RedisKeyCommands
key
in and convert it to the given TimeUnit
.
See http://redis.io/commands/ttl
public Boolean pExpire(byte[] key, long millis)
RedisKeyCommands
key
in milliseconds.
See http://redis.io/commands/pexpire
public Boolean pExpireAt(byte[] key, long unixTimeInMillis)
RedisKeyCommands
key
as a UNIX timestamp in milliseconds.
See http://redis.io/commands/pexpireat
public Long pTtl(byte[] key)
RedisKeyCommands
key
in milliseconds.
See http://redis.io/commands/pttl
public Long pTtl(byte[] key, TimeUnit timeUnit)
RedisKeyCommands
key
in and convert it to the given TimeUnit
.
See http://redis.io/commands/pttl
public byte[] dump(byte[] key)
RedisKeyCommands
key
.
See http://redis.io/commands/dump
public void restore(byte[] key, long ttlInMillis, byte[] serializedValue)
RedisKeyCommands
key
using the serializedValue
, previously obtained using RedisKeyCommands.dump(byte[])
.
See http://redis.io/commands/restore
public DataType type(byte[] key)
RedisKeyCommands
key
.
See http://redis.io/commands/type
public void unwatch()
RedisTxCommands
#watch(byte[])
keys.
See http://redis.io/commands/unwatch
public void watch(byte[]... keys)
RedisTxCommands
keys
for modifications during transaction started with RedisTxCommands.multi()
.
See http://redis.io/commands/watch
public byte[] get(byte[] key)
RedisStringCommands
key
.
See http://redis.io/commands/get
key
- must not be null.public void set(byte[] key, byte[] value)
RedisStringCommands
value
for key
.
See http://redis.io/commands/set
key
- must not be null.value
- must not be null.public void set(byte[] key, byte[] value, Expiration expiration, RedisStringCommands.SetOption option)
RedisStringCommands
value
for key
applying timeouts from expiration
if set and inserting/updating values
depending on option
.
See http://redis.io/commands/set
key
- must not be null.value
- must not be null.expiration
- can be null. Defaulted to Expiration.persistent()
.option
- can be null. Defaulted to RedisStringCommands.SetOption.UPSERT
.public byte[] getSet(byte[] key, byte[] value)
RedisStringCommands
key
and return its old value.
See http://redis.io/commands/getset
key
- must not be null.public Long append(byte[] key, byte[] value)
RedisStringCommands
value
to key
.
See http://redis.io/commands/append
key
- must not be null.public List<byte[]> mGet(byte[]... keys)
RedisStringCommands
keys
.
See http://redis.io/commands/mget
public void mSet(Map<byte[],byte[]> tuples)
RedisStringCommands
tuple
.
See http://redis.io/commands/mset
public Boolean mSetNX(Map<byte[],byte[]> tuples)
RedisStringCommands
tuple
only if the provided key does
not exist.
See http://redis.io/commands/msetnx
public void setEx(byte[] key, long time, byte[] value)
RedisStringCommands
value
and expiration in seconds
for key
.
See http://redis.io/commands/setex
key
- must not be null.value
- must not be null.public void pSetEx(byte[] key, long milliseconds, byte[] value)
RedisStringCommands
value
and expiration in milliseconds
for key
.
See http://redis.io/commands/psetex
key
- must not be null.value
- must not be null.public Boolean setNX(byte[] key, byte[] value)
RedisStringCommands
value
for key
, only if key
does not exist.
See http://redis.io/commands/setnx
key
- must not be null.value
- must not be null.public byte[] getRange(byte[] key, long start, long end)
RedisStringCommands
key
between begin
and end
.
See http://redis.io/commands/getrange
key
- must not be null.public Long decr(byte[] key)
RedisStringCommands
key
by 1.
See http://redis.io/commands/decr
key
- must not be null.public Long decrBy(byte[] key, long value)
RedisStringCommands
key
by value
.
See http://redis.io/commands/decrby
key
- must not be null.public Long incr(byte[] key)
RedisStringCommands
key
by 1.
See http://redis.io/commands/incr
key
- must not be null.public Long incrBy(byte[] key, long value)
RedisStringCommands
key
by value
.
See http://redis.io/commands/incrby
key
- must not be null.public Double incrBy(byte[] key, double value)
RedisStringCommands
key
by value
.
See http://redis.io/commands/incrbyfloat
key
- must not be null.public Boolean getBit(byte[] key, long offset)
RedisStringCommands
offset
of value at key
.
See http://redis.io/commands/getbit
key
- must not be null.public Boolean setBit(byte[] key, long offset, boolean value)
RedisStringCommands
offset
in value stored at key
.
See http://redis.io/commands/setbit
key
- must not be null.offset
.public void setRange(byte[] key, byte[] value, long start)
RedisStringCommands
key
starting at the specified offset
with given value
.
See http://redis.io/commands/setrange
key
- must not be null.public Long strLen(byte[] key)
RedisStringCommands
key
.
See http://redis.io/commands/strlen
key
- must not be null.public Long bitCount(byte[] key)
RedisStringCommands
key
.
See http://redis.io/commands/bitcount
key
- must not be null.public Long bitCount(byte[] key, long begin, long end)
RedisStringCommands
key
between begin
and
end
.
See http://redis.io/commands/bitcount
key
- must not be null.public Long bitOp(RedisStringCommands.BitOperation op, byte[] destination, byte[]... keys)
RedisStringCommands
See http://redis.io/commands/bitop
public Long lPush(byte[] key, byte[]... values)
RedisListCommands
values
to key
.
See http://redis.io/commands/lpush
public Long rPush(byte[] key, byte[]... values)
RedisListCommands
values
to key
.
See http://redis.io/commands/rpush
public List<byte[]> bLPop(int timeout, byte[]... keys)
RedisListCommands
keys
(see: RedisListCommands.lPop(byte[])
). timeout
reached.
See http://redis.io/commands/blpop
public List<byte[]> bRPop(int timeout, byte[]... keys)
RedisListCommands
keys
(see: RedisListCommands.rPop(byte[])
). timeout
reached.
See http://redis.io/commands/brpop
public byte[] lIndex(byte[] key, long index)
RedisListCommands
index
form list at key
.
See http://redis.io/commands/lindex
public Long lInsert(byte[] key, RedisListCommands.Position where, byte[] pivot, byte[] value)
RedisListCommands
value
RedisListCommands.Position.BEFORE
or RedisListCommands.Position.AFTER
existing pivot
for key
.
See http://redis.io/commands/linsert
public Long lLen(byte[] key)
RedisListCommands
key
.
See http://redis.io/commands/llen
public byte[] lPop(byte[] key)
RedisListCommands
key
.
See http://redis.io/commands/lpop
public List<byte[]> lRange(byte[] key, long start, long end)
RedisListCommands
begin
and end
from list at key
.
See http://redis.io/commands/lrange
public Long lRem(byte[] key, long count, byte[] value)
RedisListCommands
count
occurrences of value
from the list stored at key
.
See http://redis.io/commands/lrem
public void lSet(byte[] key, long index, byte[] value)
RedisListCommands
value
list element at index
.
See http://redis.io/commands/lset
public void lTrim(byte[] key, long start, long end)
RedisListCommands
key
to elements between begin
and end
.
See http://redis.io/commands/ltrim
public byte[] rPop(byte[] key)
RedisListCommands
key
.
See http://redis.io/commands/rpop
public byte[] rPopLPush(byte[] srcKey, byte[] dstKey)
RedisListCommands
srcKey
, append it to dstKey
and return its value.
See http://redis.io/commands/rpoplpush
public byte[] bRPopLPush(int timeout, byte[] srcKey, byte[] dstKey)
RedisListCommands
srcKey
, append it to dstKey
and return its value (see
RedisListCommands.rPopLPush(byte[], byte[])
). timeout
reached.
See http://redis.io/commands/brpoplpush
public Long lPushX(byte[] key, byte[] value)
RedisListCommands
values
to key
only if the list exists.
See http://redis.io/commands/lpushx
public Long rPushX(byte[] key, byte[] value)
RedisListCommands
key
only if the list exists.
See http://redis.io/commands/rpushx
public Long sAdd(byte[] key, byte[]... values)
RedisSetCommands
values
to set at key
.
See http://redis.io/commands/sadd
public Long sCard(byte[] key)
RedisSetCommands
key
.
See http://redis.io/commands/scard
public Set<byte[]> sDiff(byte[]... keys)
RedisSetCommands
keys
.
See http://redis.io/commands/sdiff
public Long sDiffStore(byte[] destKey, byte[]... keys)
RedisSetCommands
keys
and store result in destKey
See http://redis.io/commands/sdiffstore
public Set<byte[]> sInter(byte[]... keys)
RedisSetCommands
keys
.
See http://redis.io/commands/sinter
public Long sInterStore(byte[] destKey, byte[]... keys)
RedisSetCommands
keys
and store result in destKey
.
See http://redis.io/commands/sinterstore
public Boolean sIsMember(byte[] key, byte[] value)
RedisSetCommands
key
contains value
.
See http://redis.io/commands/sismember
public Set<byte[]> sMembers(byte[] key)
RedisSetCommands
key
.
See http://redis.io/commands/smembers
public Boolean sMove(byte[] srcKey, byte[] destKey, byte[] value)
RedisSetCommands
value
from srcKey
to destKey
See http://redis.io/commands/smove
public byte[] sPop(byte[] key)
RedisSetCommands
key
.
See http://redis.io/commands/spop
public byte[] sRandMember(byte[] key)
RedisSetCommands
key
.
See http://redis.io/commands/srandmember
public List<byte[]> sRandMember(byte[] key, long count)
RedisSetCommands
count
random elements from set at key
.
See http://redis.io/commands/srandmember
public Long sRem(byte[] key, byte[]... values)
RedisSetCommands
values
from set at key
and return the number of removed elements.
See http://redis.io/commands/srem
public Set<byte[]> sUnion(byte[]... keys)
RedisSetCommands
keys
.
See http://redis.io/commands/sunion
public Long sUnionStore(byte[] destKey, byte[]... keys)
RedisSetCommands
keys
and store result in destKey
.
See http://redis.io/commands/sunionstore
public Boolean zAdd(byte[] key, double score, byte[] value)
RedisZSetCommands
value
to a sorted set at key
, or update its score
if it already exists.
See http://redis.io/commands/zadd
public Long zAdd(byte[] key, Set<RedisZSetCommands.Tuple> tuples)
RedisZSetCommands
tuples
to a sorted set at key
, or update its score
if it already exists.
See http://redis.io/commands/zadd
public Long zCard(byte[] key)
RedisZSetCommands
key
.
See http://redis.io/commands/zcard
public Long zCount(byte[] key, double min, double max)
RedisZSetCommands
min
and max
.
See http://redis.io/commands/zcount
public Long zCount(byte[] key, RedisZSetCommands.Range range)
RedisZSetCommands
Range#min
and Range#max
.public Double zIncrBy(byte[] key, double increment, byte[] value)
RedisZSetCommands
value
in sorted set by increment
.
See http://redis.io/commands/zincrby
public Long zInterStore(byte[] destKey, RedisZSetCommands.Aggregate aggregate, int[] weights, byte[]... sets)
RedisZSetCommands
sets
and store result in destination key
.
See http://redis.io/commands/zinterstore
public Long zInterStore(byte[] destKey, byte[]... sets)
RedisZSetCommands
sets
and store result in destination key
.
See http://redis.io/commands/zinterstore
public Set<byte[]> zRange(byte[] key, long start, long end)
RedisZSetCommands
begin
and end
from sorted set.
See http://redis.io/commands/zrange
public Set<RedisZSetCommands.Tuple> zRangeWithScores(byte[] key, long start, long end)
RedisZSetCommands
RedisZSetCommands.Tuple
s between begin
and end
from sorted set.
See http://redis.io/commands/zrange
public Set<byte[]> zRangeByLex(byte[] key)
RedisZSetCommands
key
- must not be null.public Set<byte[]> zRangeByLex(byte[] key, RedisZSetCommands.Range range)
RedisZSetCommands
RedisZSetCommands.Range
from the sorted set at key in lexicographical ordering.key
- must not be null.range
- must not be null.public Set<byte[]> zRangeByLex(byte[] key, RedisZSetCommands.Range range, RedisZSetCommands.Limit limit)
RedisZSetCommands
RedisZSetCommands.Range
from the sorted set at key in lexicographical ordering. Result is
limited via RedisZSetCommands.Limit
.key
- must not be null.range
- must not be null.public Set<byte[]> zRangeByScore(byte[] key, double min, double max)
RedisZSetCommands
min
and max
from sorted set.
See http://redis.io/commands/zrangebyscore
public Set<byte[]> zRangeByScore(byte[] key, RedisZSetCommands.Range range)
RedisZSetCommands
Range#min
and Range#max
from sorted set.public Set<byte[]> zRangeByScore(byte[] key, RedisZSetCommands.Range range, RedisZSetCommands.Limit limit)
RedisZSetCommands
Limit#count
to Limit#offset
where score is between Range#min
and
Range#max
from sorted set.public Set<RedisZSetCommands.Tuple> zRangeByScoreWithScores(byte[] key, double min, double max)
RedisZSetCommands
RedisZSetCommands.Tuple
s where score is between min
and max
from sorted set.
See http://redis.io/commands/zrangebyscore
public Set<RedisZSetCommands.Tuple> zRangeByScoreWithScores(byte[] key, RedisZSetCommands.Range range)
RedisZSetCommands
public Set<RedisZSetCommands.Tuple> zRangeByScoreWithScores(byte[] key, RedisZSetCommands.Range range, RedisZSetCommands.Limit limit)
RedisZSetCommands
RedisZSetCommands.Tuple
s in range from Limit#offset
to Limit#offset + Limit#count
where score is
between Range#min
and Range#max
from sorted set.public Set<RedisZSetCommands.Tuple> zRevRangeWithScores(byte[] key, long start, long end)
RedisZSetCommands
RedisZSetCommands.Tuple
s in range from begin
to end
from sorted set ordered from high to low.
See http://redis.io/commands/zrevrange
public Set<byte[]> zRangeByScore(byte[] key, double min, double max, long offset, long count)
RedisZSetCommands
begin
to end
where score is between min
and max
from
sorted set.
See http://redis.io/commands/zrangebyscore
public Set<RedisZSetCommands.Tuple> zRangeByScoreWithScores(byte[] key, double min, double max, long offset, long count)
RedisZSetCommands
RedisZSetCommands.Tuple
s in range from begin
to end
where score is between min
and
max
from sorted set.
See http://redis.io/commands/zrangebyscore
public Set<byte[]> zRevRangeByScore(byte[] key, double min, double max, long offset, long count)
RedisZSetCommands
begin
to end
where score is between min
and max
from
sorted set ordered high -> low.
See http://redis.io/commands/zrevrangebyscore
public Set<byte[]> zRevRangeByScore(byte[] key, double min, double max)
RedisZSetCommands
min
and max
from sorted set ordered from high to low.
See http://redis.io/commands/zrevrange
public Set<byte[]> zRevRangeByScore(byte[] key, RedisZSetCommands.Range range)
RedisZSetCommands
Range#min
and Range#max
from sorted set ordered from high to
low.public Set<byte[]> zRevRangeByScore(byte[] key, RedisZSetCommands.Range range, RedisZSetCommands.Limit limit)
RedisZSetCommands
Limit#offset
to Limit#offset + Limit#count
where score is between
Range#min
and Range#max
from sorted set ordered high -> low.public Set<RedisZSetCommands.Tuple> zRevRangeByScoreWithScores(byte[] key, double min, double max, long offset, long count)
RedisZSetCommands
RedisZSetCommands.Tuple
in range from begin
to end
where score is between min
and
max
from sorted set ordered high -> low.
See http://redis.io/commands/zrevrangebyscore
public Set<RedisZSetCommands.Tuple> zRevRangeByScoreWithScores(byte[] key, RedisZSetCommands.Range range)
RedisZSetCommands
RedisZSetCommands.Tuple
where score is between Range#min
and Range#max
from sorted set ordered
from high to low.public Set<RedisZSetCommands.Tuple> zRevRangeByScoreWithScores(byte[] key, RedisZSetCommands.Range range, RedisZSetCommands.Limit limit)
RedisZSetCommands
RedisZSetCommands.Tuple
in range from Limit#offset
to Limit#count
where score is between
Range#min
and Range#max
from sorted set ordered high -> low.public Set<RedisZSetCommands.Tuple> zRevRangeByScoreWithScores(byte[] key, double min, double max)
RedisZSetCommands
RedisZSetCommands.Tuple
where score is between min
and max
from sorted set ordered from high to
low.
See http://redis.io/commands/zrevrange
public Long zRank(byte[] key, byte[] value)
RedisZSetCommands
value
in a sorted set.
See http://redis.io/commands/zrank
public Long zRem(byte[] key, byte[]... values)
RedisZSetCommands
values
from sorted set. Return number of removed elements.
See http://redis.io/commands/zrem
public Long zRemRange(byte[] key, long start, long end)
RedisZSetCommands
begin
and end
from sorted set with key
.
See http://redis.io/commands/zremrange
public Long zRemRangeByScore(byte[] key, double min, double max)
RedisZSetCommands
min
and max
from sorted set with key
.
See http://redis.io/commands/zremrangebyscore
public Long zRemRangeByScore(byte[] key, RedisZSetCommands.Range range)
RedisZSetCommands
Range#min
and Range#max
from sorted set with key
.public Set<byte[]> zRevRange(byte[] key, long start, long end)
RedisZSetCommands
begin
to end
from sorted set ordered from high to low.
See http://redis.io/commands/zrevrange
public Long zRevRank(byte[] key, byte[] value)
RedisZSetCommands
value
in a sorted set when scored high to low.
See http://redis.io/commands/zrevrank
public Double zScore(byte[] key, byte[] value)
RedisZSetCommands
value
from sorted set with key key
.
See http://redis.io/commands/zrem
public Long zUnionStore(byte[] destKey, RedisZSetCommands.Aggregate aggregate, int[] weights, byte[]... sets)
RedisZSetCommands
sets
and store result in destination key
.
See http://redis.io/commands/zunionstore
public Long zUnionStore(byte[] destKey, byte[]... sets)
RedisZSetCommands
sets
and store result in destination key
.
See http://redis.io/commands/zunionstore
public Boolean hSet(byte[] key, byte[] field, byte[] value)
RedisHashCommands
value
of a hash field
.http://redis.io/commands/hset
public Boolean hSetNX(byte[] key, byte[] field, byte[] value)
RedisHashCommands
value
of a hash field
only if field
does not exist.http://redis.io/commands/hsetnx
public Long hDel(byte[] key, byte[]... fields)
RedisHashCommands
fields
.http://redis.io/commands/hdel
public Boolean hExists(byte[] key, byte[] field)
RedisHashCommands
field
exists.http://redis.io/commands/hexits
public byte[] hGet(byte[] key, byte[] field)
RedisHashCommands
field
from hash at key
.http://redis.io/commands/hget
public Map<byte[],byte[]> hGetAll(byte[] key)
RedisHashCommands
key
.http://redis.io/commands/hgetall
public Long hIncrBy(byte[] key, byte[] field, long delta)
RedisHashCommands
value
of a hash field
by the given delta
.http://redis.io/commands/hincrby
public Double hIncrBy(byte[] key, byte[] field, double delta)
RedisHashCommands
value
of a hash field
by the given delta
.http://redis.io/commands/hincrbyfloat
public Set<byte[]> hKeys(byte[] key)
RedisHashCommands
key
.http://redis.io/commands/h?
public Long hLen(byte[] key)
RedisHashCommands
key
.http://redis.io/commands/hlen
public List<byte[]> hMGet(byte[] key, byte[]... fields)
RedisHashCommands
fields
from hash at key
.http://redis.io/commands/hmget
public void hMSet(byte[] key, Map<byte[],byte[]> tuple)
RedisHashCommands
hashes
http://redis.io/commands/hmset
public List<byte[]> hVals(byte[] key)
RedisHashCommands
field
.http://redis.io/commands/hvals
public Long publish(byte[] channel, byte[] message)
RedisPubSubCommands
channel
- the channel to publish tomessage
- message to publishpublic Subscription getSubscription()
RedisPubSubCommands
public boolean isSubscribed()
RedisPubSubCommands
public void pSubscribe(MessageListener listener, byte[]... patterns)
RedisPubSubCommands
Note that this operation is blocking and the current thread starts waiting for new messages immediately.
listener
- message listenerpatterns
- channel name patternspublic void subscribe(MessageListener listener, byte[]... channels)
RedisPubSubCommands
Note that this operation is blocking and the current thread starts waiting for new messages immediately.
listener
- message listenerchannels
- channel namespublic Long geoAdd(byte[] key, Point point, byte[] member)
RedisGeoCommands
Point
with given member name to key.key
- must not be null.point
- must not be null.member
- must not be null.public Long geoAdd(byte[] key, RedisGeoCommands.GeoLocation<byte[]> location)
RedisGeoCommands
RedisGeoCommands.GeoLocation
to key.key
- must not be null.location
- must not be null.public Long geoAdd(byte[] key, Map<byte[],Point> memberCoordinateMap)
RedisGeoCommands
key
- must not be null.memberCoordinateMap
- must not be null.public Long geoAdd(byte[] key, Iterable<RedisGeoCommands.GeoLocation<byte[]>> locations)
RedisGeoCommands
RedisGeoCommands.GeoLocation
s to keykey
- must not be null.locations
- must not be null.public Distance geoDist(byte[] key, byte[] member1, byte[] member2)
RedisGeoCommands
Distance
between member1 and member2.key
- must not be null.member1
- must not be null.member2
- must not be null.public Distance geoDist(byte[] key, byte[] member1, byte[] member2, Metric metric)
RedisGeoCommands
key
- must not be null.member1
- must not be null.member2
- must not be null.metric
- must not be null.public List<String> geoHash(byte[] key, byte[]... members)
RedisGeoCommands
key
- must not be null.members
- must not be null.public List<Point> geoPos(byte[] key, byte[]... members)
RedisGeoCommands
Point
representation of positions for one or more members.key
- must not be null.members
- must not be null.public GeoResults<RedisGeoCommands.GeoLocation<byte[]>> geoRadius(byte[] key, Circle within)
RedisGeoCommands
Circle
.key
- must not be null.within
- must not be null.public GeoResults<RedisGeoCommands.GeoLocation<byte[]>> geoRadius(byte[] key, Circle within, RedisGeoCommands.GeoRadiusCommandArgs args)
RedisGeoCommands
Circle
applying RedisGeoCommands.GeoRadiusCommandArgs
.key
- must not be null.within
- must not be null.args
- must not be null.public GeoResults<RedisGeoCommands.GeoLocation<byte[]>> geoRadiusByMember(byte[] key, byte[] member, double radius)
RedisGeoCommands
key
- must not be null.member
- must not be null.public GeoResults<RedisGeoCommands.GeoLocation<byte[]>> geoRadiusByMember(byte[] key, byte[] member, Distance radius)
RedisGeoCommands
Distance
.key
- must not be null.member
- must not be null.radius
- must not be null.public GeoResults<RedisGeoCommands.GeoLocation<byte[]>> geoRadiusByMember(byte[] key, byte[] member, Distance radius, RedisGeoCommands.GeoRadiusCommandArgs args)
RedisGeoCommands
Distance
and RedisGeoCommands.GeoRadiusCommandArgs
.key
- must not be null.member
- must not be null.radius
- must not be null.args
- must not be null.public Long geoRemove(byte[] key, byte[]... members)
RedisGeoCommands
key
- must not be null.members
- must not be null.public void scriptFlush()
RedisScriptingCommands
See http://redis.io/commands/script-flush
public void scriptKill()
RedisScriptingCommands
See http://redis.io/commands/script-kill
public String scriptLoad(byte[] script)
RedisScriptingCommands
#evalSha(String, ReturnType, int, byte[])
.
See http://redis.io/commands/script-load
public List<Boolean> scriptExists(String... scriptSha1)
RedisScriptingCommands
scriptShas
exist in script cache.
See http://redis.io/commands/script-exits
public <T> T eval(byte[] script, ReturnType returnType, int numKeys, byte[]... keysAndArgs)
RedisScriptingCommands
script
.
See http://redis.io/commands/eval
public <T> T evalSha(String scriptSha1, ReturnType returnType, int numKeys, byte[]... keysAndArgs)
RedisScriptingCommands
scriptSha
.
See http://redis.io/commands/evalsha
public <T> T evalSha(byte[] scriptSha1, ReturnType returnType, int numKeys, byte[]... keysAndArgs)
RedisScriptingCommands
scriptSha
.
See http://redis.io/commands/evalsha
public Long time()
RedisServerCommands
TIME
command.public void killClient(String host, int port)
RedisServerCommands
host
- of connection to close.port
- of connection to closepublic void slaveOf(String host, int port)
RedisServerCommands
See http://redis.io/commands/slaveof
public void setClientName(byte[] name)
RedisServerCommands
public String getClientName()
RedisServerCommands
See http://redis.io/commands/client-getname
public List<RedisClientInfo> getClientList()
RedisServerCommands
See http://redis.io/commands/client-list
List
of RedisClientInfo
objects.public void slaveOfNoOne()
RedisServerCommands
See http://redis.io/commands/slaveof
public Cursor<byte[]> scan()
public Cursor<byte[]> scan(ScanOptions options)
RedisKeyCommands
Cursor
to iterate over keys.
See http://redis.io/commands/scan
public Cursor<byte[]> scan(long cursorId, ScanOptions options)
cursorId
- options
- public Cursor<RedisZSetCommands.Tuple> zScan(byte[] key, ScanOptions options)
RedisZSetCommands
public Cursor<RedisZSetCommands.Tuple> zScan(byte[] key, Long cursorId, ScanOptions options)
key
- cursorId
- options
- public Cursor<byte[]> sScan(byte[] key, ScanOptions options)
RedisSetCommands
public Cursor<byte[]> sScan(byte[] key, long cursorId, ScanOptions options)
key
- cursorId
- options
- public Cursor<Map.Entry<byte[],byte[]>> hScan(byte[] key, ScanOptions options)
RedisHashCommands
Cursor
to iterate over entries in hash at key
.http://redis.io/commands/scan
public Cursor<Map.Entry<byte[],byte[]>> hScan(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 Jedis driverconvertPipelineAndTxResults
- Whether or not to convert pipeline and tx resultsprotected boolean isActive(RedisNode node)
AbstractRedisConnection
isActive
in class AbstractRedisConnection
protected JedisSentinelConnection getSentinelConnection(RedisNode sentinel)
AbstractRedisConnection
RedisSentinelCommands
connected to given node.getSentinelConnection
in class AbstractRedisConnection
protected redis.clients.jedis.Jedis getJedis(RedisNode node)
public Set<byte[]> zRangeByScore(byte[] key, String min, String max)
RedisZSetCommands
min
and max
from sorted set.
See http://redis.io/commands/zrangebyscore
public Set<byte[]> zRangeByScore(byte[] key, String min, String max, long offset, long count)
RedisZSetCommands
begin
to end
where score is between min
and max
from
sorted set.
See http://redis.io/commands/zrangebyscore
public Long pfAdd(byte[] key, byte[]... values)
HyperLogLogCommands
public Long pfCount(byte[]... keys)
HyperLogLogCommands
public void pfMerge(byte[] destinationKey, byte[]... sourceKeys)
HyperLogLogCommands
public void migrate(byte[] key, RedisNode target, int dbIndex, RedisServerCommands.MigrateOption option)
key
- must not be null.target
- must not be null.option
- can be null. Defaulted to RedisServerCommands.MigrateOption.COPY
.public void migrate(byte[] key, RedisNode target, int dbIndex, RedisServerCommands.MigrateOption option, long timeout)
key
- must not be null.target
- must not be null.option
- can be null. Defaulted to RedisServerCommands.MigrateOption.COPY
.Copyright © 2011-2016–2016 Pivotal Software, Inc.. All rights reserved.