public class Jedis extends BinaryJedis implements JedisCommands, MultiKeyCommands, AdvancedJedisCommands, ScriptingCommands, BasicCommands, ClusterCommands, SentinelCommands, ModuleCommands
BinaryJedis.SetFromList<E>
Modifier and Type | Field and Description |
---|---|
protected JedisPoolAbstract |
dataSource
Deprecated.
This will be private in future.
|
client, DUMMY_ARRAY, pipeline, transaction
Constructor and Description |
---|
Jedis() |
Jedis(HostAndPort hp) |
Jedis(HostAndPort hp,
JedisClientConfig config) |
Jedis(JedisShardInfo shardInfo) |
Jedis(JedisSocketFactory jedisSocketFactory)
Deprecated.
This constructor will be removed in future major release.
Use
Jedis(redis.clients.jedis.JedisSocketFactory, redis.clients.jedis.JedisClientConfig) . |
Jedis(JedisSocketFactory jedisSocketFactory,
JedisClientConfig clientConfig) |
Jedis(String uri)
Deprecated.
This constructor will not support a host string in future. It will accept only a
uri string.
JedisURIHelper#isValid(java.net.URI) can used before this. If this
constructor was being used with a host, it can be replaced with
Jedis(java.lang.String, int) with the host and Protocol.DEFAULT_PORT . |
Jedis(String host,
int port) |
Jedis(String host,
int port,
boolean ssl) |
Jedis(String host,
int port,
boolean ssl,
SSLSocketFactory sslSocketFactory,
SSLParameters sslParameters,
HostnameVerifier hostnameVerifier) |
Jedis(String host,
int port,
int timeout) |
Jedis(String host,
int port,
int timeout,
boolean ssl) |
Jedis(String host,
int port,
int timeout,
boolean ssl,
SSLSocketFactory sslSocketFactory,
SSLParameters sslParameters,
HostnameVerifier hostnameVerifier) |
Jedis(String host,
int port,
int connectionTimeout,
int soTimeout) |
Jedis(String host,
int port,
int connectionTimeout,
int soTimeout,
boolean ssl) |
Jedis(String host,
int port,
int connectionTimeout,
int soTimeout,
boolean ssl,
SSLSocketFactory sslSocketFactory,
SSLParameters sslParameters,
HostnameVerifier hostnameVerifier) |
Jedis(String host,
int port,
int connectionTimeout,
int soTimeout,
int infiniteSoTimeout) |
Jedis(String host,
int port,
int connectionTimeout,
int soTimeout,
int infiniteSoTimeout,
boolean ssl,
SSLSocketFactory sslSocketFactory,
SSLParameters sslParameters,
HostnameVerifier hostnameVerifier) |
Jedis(URI uri) |
Jedis(URI uri,
int timeout) |
Jedis(URI uri,
int connectionTimeout,
int soTimeout) |
Jedis(URI uri,
int connectionTimeout,
int soTimeout,
int infiniteSoTimeout,
SSLSocketFactory sslSocketFactory,
SSLParameters sslParameters,
HostnameVerifier hostnameVerifier) |
Jedis(URI uri,
int connectionTimeout,
int soTimeout,
SSLSocketFactory sslSocketFactory,
SSLParameters sslParameters,
HostnameVerifier hostnameVerifier) |
Jedis(URI uri,
int timeout,
SSLSocketFactory sslSocketFactory,
SSLParameters sslParameters,
HostnameVerifier hostnameVerifier) |
Jedis(URI uri,
JedisClientConfig config) |
Jedis(URI uri,
SSLSocketFactory sslSocketFactory,
SSLParameters sslParameters,
HostnameVerifier hostnameVerifier) |
Modifier and Type | Method and Description |
---|---|
List<String> |
aclCat() |
List<String> |
aclCat(String category) |
Long |
aclDelUser(String name) |
String |
aclGenPass() |
AccessControlUser |
aclGetUser(String name) |
List<String> |
aclList() |
String |
aclLoad() |
List<AccessControlLogEntry> |
aclLog() |
List<AccessControlLogEntry> |
aclLog(int limit) |
String |
aclLog(String options)
Deprecated.
|
String |
aclSave() |
String |
aclSetUser(String name) |
String |
aclSetUser(String name,
String... params) |
List<String> |
aclUsers() |
String |
aclWhoAmI() |
Long |
append(String key,
String value)
If the key already exists and is a string, this command appends the provided value at the end
of the string.
|
String |
asking() |
Long |
bitcount(String key) |
Long |
bitcount(String key,
long start,
long end) |
List<Long> |
bitfield(String key,
String... arguments)
Executes BITFIELD Redis command
|
List<Long> |
bitfieldReadonly(String key,
String... arguments) |
Long |
bitop(BitOP op,
String destKey,
String... srcKeys) |
Long |
bitpos(String key,
boolean value) |
Long |
bitpos(String key,
boolean value,
BitPosParams params) |
String |
blmove(String srcKey,
String dstKey,
ListDirection from,
ListDirection to,
double timeout) |
KeyedListElement |
blpop(double timeout,
String... keys) |
KeyedListElement |
blpop(double timeout,
String key) |
List<String> |
blpop(int timeout,
String... keys)
BLPOP (and BRPOP) is a blocking list pop primitive.
|
List<String> |
blpop(int timeout,
String key) |
List<String> |
blpop(String... args) |
KeyedListElement |
brpop(double timeout,
String... keys) |
KeyedListElement |
brpop(double timeout,
String key) |
List<String> |
brpop(int timeout,
String... keys)
BLPOP (and BRPOP) is a blocking list pop primitive.
|
List<String> |
brpop(int timeout,
String key) |
List<String> |
brpop(String... args) |
String |
brpoplpush(String source,
String destination,
int timeout)
Pop a value from a list, push it to another list and return it; or block until one is available
|
KeyedZSetElement |
bzpopmax(double timeout,
String... keys) |
KeyedZSetElement |
bzpopmin(double timeout,
String... keys) |
String |
clientGetname() |
Long |
clientId() |
String |
clientInfo() |
String |
clientKill(String ipPort) |
String |
clientList() |
String |
clientList(ClientType type) |
String |
clientList(long... clientIds) |
String |
clientSetname(String name) |
Long |
clientUnblock(long clientId,
UnblockType unblockType)
Unblock a client blocked in a blocking command from a different connection.
|
void |
close() |
String |
clusterAddSlots(int... slots) |
Long |
clusterCountKeysInSlot(int slot) |
String |
clusterDelSlots(int... slots) |
String |
clusterFailover(ClusterFailoverOption failoverOption) |
String |
clusterFlushSlots() |
String |
clusterForget(String nodeId) |
List<String> |
clusterGetKeysInSlot(int slot,
int count) |
List<byte[]> |
clusterGetKeysInSlotBinary(int slot,
int count) |
String |
clusterInfo() |
Long |
clusterKeySlot(String key) |
String |
clusterMeet(String ip,
int port) |
String |
clusterMyId() |
String |
clusterNodes() |
String |
clusterReplicas(String nodeId) |
String |
clusterReplicate(String nodeId) |
String |
clusterReset(ClusterReset resetType) |
String |
clusterReset(ClusterResetType resetType)
resetType can be null for default behavior. |
String |
clusterSaveConfig() |
String |
clusterSetSlotImporting(int slot,
String nodeId) |
String |
clusterSetSlotMigrating(int slot,
String nodeId) |
String |
clusterSetSlotNode(int slot,
String nodeId) |
String |
clusterSetSlotStable(int slot) |
List<String> |
clusterSlaves(String nodeId)
CLUSTER SLAVES command is deprecated since Redis 5. |
List<Object> |
clusterSlots() |
List<String> |
configGet(String pattern)
Retrieve the configuration of a running Redis server.
|
String |
configSet(String parameter,
String value)
Alter the configuration of a running Redis server.
|
Boolean |
copy(String srcKey,
String dstKey,
boolean replace)
COPY source destination [DB destination-db] [REPLACE]
|
Boolean |
copy(String srcKey,
String dstKey,
int db,
boolean replace)
COPY source destination [DB destination-db] [REPLACE]
|
Long |
decr(String key)
Decrement the number stored at key by one.
|
Long |
decrBy(String key,
long decrement)
IDECRBY work just like
INCR but instead to decrement by 1 the decrement
is integer. |
Long |
del(String... keys)
Remove the specified keys.
|
Long |
del(String key) |
byte[] |
dump(String key) |
String |
echo(String string) |
Object |
eval(String script) |
Object |
eval(String script,
int keyCount,
String... params) |
Object |
eval(String script,
List<String> keys,
List<String> args) |
Object |
evalsha(String sha1) |
Object |
evalsha(String sha1,
int keyCount,
String... params) |
Object |
evalsha(String sha1,
List<String> keys,
List<String> args) |
Long |
exists(String... keys)
Test if the specified keys exist.
|
Boolean |
exists(String key)
Test if the specified key exists.
|
Long |
expire(String key,
long seconds)
Set a timeout on the specified key.
|
Long |
expireAt(String key,
long unixTime)
EXPIREAT works exactly like
EXPIRE but instead to get the number
of seconds representing the Time To Live of the key as a second argument (that is a relative
way of specifying the TTL), it takes an absolute one in the form of a UNIX timestamp (Number of
seconds elapsed since 1 Gen 1970). |
Long |
geoadd(String key,
double longitude,
double latitude,
String member) |
Long |
geoadd(String key,
GeoAddParams params,
Map<String,GeoCoordinate> memberCoordinateMap) |
Long |
geoadd(String key,
Map<String,GeoCoordinate> memberCoordinateMap) |
Double |
geodist(String key,
String member1,
String member2) |
Double |
geodist(String key,
String member1,
String member2,
GeoUnit unit) |
List<String> |
geohash(String key,
String... members) |
List<GeoCoordinate> |
geopos(String key,
String... members) |
List<GeoRadiusResponse> |
georadius(String key,
double longitude,
double latitude,
double radius,
GeoUnit unit) |
List<GeoRadiusResponse> |
georadius(String key,
double longitude,
double latitude,
double radius,
GeoUnit unit,
GeoRadiusParam param) |
List<GeoRadiusResponse> |
georadiusByMember(String key,
String member,
double radius,
GeoUnit unit) |
List<GeoRadiusResponse> |
georadiusByMember(String key,
String member,
double radius,
GeoUnit unit,
GeoRadiusParam param) |
List<GeoRadiusResponse> |
georadiusByMemberReadonly(String key,
String member,
double radius,
GeoUnit unit) |
List<GeoRadiusResponse> |
georadiusByMemberReadonly(String key,
String member,
double radius,
GeoUnit unit,
GeoRadiusParam param) |
Long |
georadiusByMemberStore(String key,
String member,
double radius,
GeoUnit unit,
GeoRadiusParam param,
GeoRadiusStoreParam storeParam) |
List<GeoRadiusResponse> |
georadiusReadonly(String key,
double longitude,
double latitude,
double radius,
GeoUnit unit) |
List<GeoRadiusResponse> |
georadiusReadonly(String key,
double longitude,
double latitude,
double radius,
GeoUnit unit,
GeoRadiusParam param) |
Long |
georadiusStore(String key,
double longitude,
double latitude,
double radius,
GeoUnit unit,
GeoRadiusParam param,
GeoRadiusStoreParam storeParam) |
String |
get(String key)
Get the value of the specified key.
|
Boolean |
getbit(String key,
long offset)
Returns the bit value at offset in the string value stored at key
|
String |
getDel(String key)
Get the value of key and delete the key.
|
String |
getEx(String key,
GetExParams params) |
protected static String[] |
getParams(List<String> keys,
List<String> args) |
String |
getrange(String key,
long startOffset,
long endOffset) |
String |
getSet(String key,
String value)
GETSET is an atomic set this value and return the old value command.
|
Long |
hdel(String key,
String... fields)
Remove the specified field from an hash stored at key.
|
Boolean |
hexists(String key,
String field)
Test for existence of a specified field in a hash.
|
String |
hget(String key,
String field)
If key holds a hash, retrieve the value associated to the specified field.
|
Map<String,String> |
hgetAll(String key)
Return all the fields and associated values in a hash.
|
Long |
hincrBy(String key,
String field,
long value)
Increment the number stored at field in the hash at key by value.
|
Double |
hincrByFloat(String key,
String field,
double value)
Increment the number stored at field in the hash at key by a double precision floating point
value.
|
Set<String> |
hkeys(String key)
Return all the fields in a hash.
|
Long |
hlen(String key)
Return the number of items in a hash.
|
List<String> |
hmget(String key,
String... fields)
Retrieve the values associated to the specified fields.
|
String |
hmset(String key,
Map<String,String> hash)
Set the respective fields to the respective values.
|
String |
hrandfield(String key)
Get one random field from a hash.
|
List<String> |
hrandfield(String key,
long count)
Get multiple random fields from a hash.
|
Map<String,String> |
hrandfieldWithValues(String key,
long count)
Get one or multiple random fields with values from a hash.
|
ScanResult<Map.Entry<String,String>> |
hscan(String key,
String cursor) |
ScanResult<Map.Entry<String,String>> |
hscan(String key,
String cursor,
ScanParams params) |
Long |
hset(String key,
Map<String,String> hash) |
Long |
hset(String key,
String field,
String value)
Set the specified hash field to the specified value.
|
Long |
hsetnx(String key,
String field,
String value)
Set the specified hash field to the specified value if the field not exists.
|
Long |
hstrlen(String key,
String field)
Used for HSTRLEN Redis command
|
List<String> |
hvals(String key)
Return all the values in a hash.
|
Long |
incr(String key)
Increment the number stored at key by one.
|
Long |
incrBy(String key,
long increment)
INCRBY work just like
INCR but instead to increment by 1 the increment is
integer. |
Double |
incrByFloat(String key,
double increment)
INCRBYFLOAT
|
Set<String> |
keys(String pattern)
Returns all the keys matching the glob-style pattern.
|
String |
lindex(String key,
long index)
Return the specified element of the list stored at the specified key.
|
Long |
linsert(String key,
ListPosition where,
String pivot,
String value) |
Long |
llen(String key)
Return the length of the list stored at the specified key.
|
String |
lmove(String srcKey,
String dstKey,
ListDirection from,
ListDirection to) |
String |
lpop(String key)
Atomically return and remove the first (LPOP) or last (RPOP) element of the list.
|
List<String> |
lpop(String key,
int count) |
Long |
lpos(String key,
String element) |
Long |
lpos(String key,
String element,
LPosParams params) |
List<Long> |
lpos(String key,
String element,
LPosParams params,
long count) |
Long |
lpush(String key,
String... strings)
Add the string value to the head (LPUSH) or tail (RPUSH) of the list stored at key.
|
Long |
lpushx(String key,
String... string) |
List<String> |
lrange(String key,
long start,
long stop)
Return the specified elements of the list stored at the specified key.
|
Long |
lrem(String key,
long count,
String value)
Remove the first count occurrences of the value element from the list.
|
String |
lset(String key,
long index,
String value)
Set a new value as the element at index position of the List at key.
|
String |
ltrim(String key,
long start,
long stop)
Trim an existing list so that it will contain only the specified range of elements specified.
|
String |
memoryDoctor() |
Long |
memoryUsage(String key) |
Long |
memoryUsage(String key,
int samples) |
List<String> |
mget(String... keys)
Get the values of all the specified keys.
|
String |
migrate(String host,
int port,
int destinationDB,
int timeout,
MigrateParams params,
String... keys) |
String |
migrate(String host,
int port,
String key,
int destinationDb,
int timeout) |
List<Module> |
moduleList() |
String |
moduleLoad(String path) |
String |
moduleUnload(String name) |
Long |
move(String key,
int dbIndex)
Move the specified key from the currently selected DB to the specified destination DB.
|
String |
mset(String... keysvalues)
Set the the respective keys to the respective values.
|
Long |
msetnx(String... keysvalues)
Set the the respective keys to the respective values.
|
String |
objectEncoding(String key) |
Long |
objectFreq(String key) |
List<String> |
objectHelp() |
Long |
objectIdletime(String key) |
Long |
objectRefcount(String key) |
Long |
persist(String key)
Undo a
expire at turning the expire key into a normal key. |
Long |
pexpire(String key,
long milliseconds) |
Long |
pexpireAt(String key,
long millisecondsTimestamp) |
Long |
pfadd(String key,
String... elements) |
long |
pfcount(String... keys) |
long |
pfcount(String key) |
String |
pfmerge(String destkey,
String... sourcekeys) |
String |
ping(String message)
Works same as ping() but returns argument message instead of PONG.
|
String |
psetex(String key,
long milliseconds,
String value)
PSETEX works exactly like
JedisCommands.setex(String, int, String) with the sole difference that the
expire time is specified in milliseconds instead of seconds. |
void |
psubscribe(JedisPubSub jedisPubSub,
String... patterns) |
Long |
pttl(String key) |
Long |
publish(String channel,
String message) |
List<String> |
pubsubChannels() |
List<String> |
pubsubChannels(String pattern) |
Long |
pubsubNumPat() |
Map<String,String> |
pubsubNumSub(String... channels)
WARNING: This method will return
java.util.Map<java.lang.String, java.lang.Long> in next major release. |
String |
randomKey()
Return a randomly selected key from the currently selected DB.
|
String |
readonly() |
String |
readwrite() |
String |
rename(String oldkey,
String newkey)
Atomically renames the key oldkey to newkey.
|
Long |
renamenx(String oldkey,
String newkey)
Rename oldkey into newkey but fails if the destination key newkey already exists.
|
String |
restore(String key,
long ttl,
byte[] serializedValue) |
String |
restore(String key,
long ttl,
byte[] serializedValue,
RestoreParams params) |
String |
restoreReplace(String key,
long ttl,
byte[] serializedValue) |
List<Object> |
role() |
String |
rpop(String key)
Atomically return and remove the first (LPOP) or last (RPOP) element of the list.
|
List<String> |
rpop(String key,
int count) |
String |
rpoplpush(String srckey,
String dstkey)
Atomically return and remove the last (tail) element of the srckey list, and push the element
as the first (head) element of the dstkey list.
|
Long |
rpush(String key,
String... strings)
Add the string value to the head (LPUSH) or tail (RPUSH) of the list stored at key.
|
Long |
rpushx(String key,
String... string) |
Long |
sadd(String key,
String... members)
Add the specified member to the set value stored at key.
|
ScanResult<String> |
scan(String cursor) |
ScanResult<String> |
scan(String cursor,
ScanParams params)
Iterates the set of keys in the currently selected Redis database.
|
ScanResult<String> |
scan(String cursor,
ScanParams params,
String type) |
Long |
scard(String key)
Return the set cardinality (number of elements).
|
List<Boolean> |
scriptExists(String... sha1) |
Boolean |
scriptExists(String sha1) |
String |
scriptLoad(String script) |
Set<String> |
sdiff(String... keys)
Return the difference between the Set stored at key1 and all the Sets key2, ..., keyN
|
Long |
sdiffstore(String dstkey,
String... keys)
This command works exactly like
SDIFF but instead of being returned
the resulting set is stored in dstkey. |
Object |
sendBlockingCommand(ProtocolCommand cmd,
String... args) |
Object |
sendCommand(ProtocolCommand cmd,
String... args) |
String |
sentinelFailover(String masterName) |
List<String> |
sentinelGetMasterAddrByName(String masterName)
redis 127.0.0.1:26381> sentinel get-master-addr-by-name mymaster
1) "127.0.0.1"
2) "6379"
|
Map<String,String> |
sentinelMaster(String masterName) |
List<Map<String,String>> |
sentinelMasters()
redis 127.0.0.1:26381> sentinel masters
1) 1) "name"
2) "mymaster"
3) "ip"
4) "127.0.0.1"
5) "port"
6) "6379"
7) "runid"
8) "93d4d4e6e9c06d0eea36e27f31924ac26576081d"
9) "flags"
10) "master"
11) "pending-commands"
12) "0"
13) "last-ok-ping-reply"
14) "423"
15) "last-ping-reply"
16) "423"
17) "info-refresh"
18) "6107"
19) "num-slaves"
20) "1"
21) "num-other-sentinels"
22) "2"
23) "quorum"
24) "2"
|
String |
sentinelMonitor(String masterName,
String ip,
int port,
int quorum) |
String |
sentinelMyId() |
String |
sentinelRemove(String masterName) |
List<Map<String,String>> |
sentinelReplicas(String masterName)
redis 127.0.0.1:26381> sentinel replicas mymaster
1) 1) "name"
2) "127.0.0.1:6380"
3) "ip"
4) "127.0.0.1"
5) "port"
6) "6380"
7) "runid"
8) "d7f6c0ca7572df9d2f33713df0dbf8c72da7c039"
9) "flags"
10) "slave"
11) "pending-commands"
12) "0"
13) "last-ok-ping-reply"
14) "47"
15) "last-ping-reply"
16) "47"
17) "info-refresh"
18) "657"
19) "master-link-down-time"
20) "0"
21) "master-link-status"
22) "ok"
23) "master-host"
24) "localhost"
25) "master-port"
26) "6379"
27) "slave-priority"
28) "100"
|
Long |
sentinelReset(String pattern)
redis 127.0.0.1:26381> sentinel reset mymaster
(integer) 1
|
List<Map<String,String>> |
sentinelSentinels(String masterName) |
String |
sentinelSet(String masterName,
Map<String,String> parameterMap) |
List<Map<String,String>> |
sentinelSlaves(String masterName)
Deprecated.
|
String |
set(String key,
String value)
Set the string value as value of the key.
|
String |
set(String key,
String value,
SetParams params)
Set the string value as value of the key.
|
Boolean |
setbit(String key,
long offset,
boolean value)
Sets or clears the bit at offset in the string value stored at key
|
Boolean |
setbit(String key,
long offset,
String value)
Deprecated.
|
void |
setDataSource(JedisPoolAbstract jedisPool)
WARNING: This will be changed to
protected in next major release. |
String |
setex(String key,
long seconds,
String value)
|
Long |
setnx(String key,
String value)
SETNX works exactly like
SET with the only difference that if the
key already exists no operation is performed. |
Long |
setrange(String key,
long offset,
String value) |
Set<String> |
sinter(String... keys)
Return the members of a set resulting from the intersection of all the sets hold at the
specified keys.
|
Long |
sinterstore(String dstkey,
String... keys)
This command works exactly like
SINTER but instead of being returned
the resulting set is stored as dstkey. |
Boolean |
sismember(String key,
String member)
Return true if member is a member of the set stored at key, otherwise false is returned.
|
List<Slowlog> |
slowlogGet() |
List<Slowlog> |
slowlogGet(long entries) |
Set<String> |
smembers(String key)
Return all the members (elements) of the set value stored at key.
|
List<Boolean> |
smismember(String key,
String... members)
Returns whether each member is a member of the set stored at key.
|
Long |
smove(String srckey,
String dstkey,
String member)
Move the specified member from the set at srckey to the set at dstkey.
|
List<String> |
sort(String key)
Sort a Set or a List.
|
List<String> |
sort(String key,
SortingParams sortingParameters)
Sort a Set or a List accordingly to the specified parameters.
|
Long |
sort(String key,
SortingParams sortingParameters,
String dstkey)
Sort a Set or a List accordingly to the specified parameters and store the result at dstkey.
|
Long |
sort(String key,
String dstkey)
Sort a Set or a List and Store the Result at dstkey.
|
String |
spop(String key)
Remove a random element from a Set returning it as return value.
|
Set<String> |
spop(String key,
long count) |
String |
srandmember(String key)
Return a random element from a Set, without removing the element.
|
List<String> |
srandmember(String key,
int count)
Return a random elements from a Set, without removing the elements.
|
Long |
srem(String key,
String... members)
Remove the specified member from the set value stored at key.
|
ScanResult<String> |
sscan(String key,
String cursor) |
ScanResult<String> |
sscan(String key,
String cursor,
ScanParams params) |
LCSMatchResult |
strAlgoLCSKeys(String keyA,
String keyB,
StrAlgoLCSParams params)
Calculate the longest common subsequence of keyA and keyB.
|
LCSMatchResult |
strAlgoLCSStrings(String strA,
String strB,
StrAlgoLCSParams params)
Calculate the longest common subsequence of strA and strB.
|
Long |
strlen(String key) |
void |
subscribe(JedisPubSub jedisPubSub,
String... channels) |
String |
substr(String key,
int start,
int end)
Return a subset of the string from offset start to offset end (both offsets are inclusive).
|
Set<String> |
sunion(String... keys)
Return the members of a set resulting from the union of all the sets hold at the specified
keys.
|
Long |
sunionstore(String dstkey,
String... keys)
This command works exactly like
SUNION but instead of being returned
the resulting set is stored as dstkey. |
Long |
touch(String... keys)
Alters the last access time of a key(s).
|
Long |
touch(String key) |
Long |
ttl(String key)
The TTL command returns the remaining time to live in seconds of a key that has an
EXPIRE set. |
String |
type(String key)
Return the type of the value stored at key in form of a string.
|
Long |
unlink(String... keys)
This command is very similar to DEL: it removes the specified keys.
|
Long |
unlink(String key) |
String |
watch(String... keys) |
long |
xack(String key,
String group,
StreamEntryID... ids)
XACK key group ID [ID ...]
|
StreamEntryID |
xadd(String key,
Map<String,String> hash,
XAddParams params)
XADD key [NOMKSTREAM] [MAXLEN|MINID [=|~] threshold [LIMIT count]] *|ID field value [field value ...]
|
StreamEntryID |
xadd(String key,
StreamEntryID id,
Map<String,String> hash)
XADD key ID field string [field string ...]
|
StreamEntryID |
xadd(String key,
StreamEntryID id,
Map<String,String> hash,
long maxLen,
boolean approximateLength)
XADD key MAXLEN ~ LEN ID field string [field string ...]
|
Map.Entry<StreamEntryID,List<StreamEntry>> |
xautoclaim(String key,
String group,
String consumerName,
long minIdleTime,
StreamEntryID start,
XAutoClaimParams params)
XAUTOCLAIM key group consumer min-idle-time start [COUNT count]
|
Map.Entry<StreamEntryID,List<StreamEntryID>> |
xautoclaimJustId(String key,
String group,
String consumerName,
long minIdleTime,
StreamEntryID start,
XAutoClaimParams params)
XAUTOCLAIM key group consumer min-idle-time start [COUNT count] JUSTID
|
List<StreamEntry> |
xclaim(String key,
String group,
String consumername,
long minIdleTime,
long newIdleTime,
int retries,
boolean force,
StreamEntryID... ids)
XCLAIM
|
List<StreamEntry> |
xclaim(String key,
String group,
String consumername,
long minIdleTime,
XClaimParams params,
StreamEntryID... ids)
XCLAIM
|
List<StreamEntryID> |
xclaimJustId(String key,
String group,
String consumername,
long minIdleTime,
XClaimParams params,
StreamEntryID... ids)
XCLAIM
|
long |
xdel(String key,
StreamEntryID... ids)
XDEL key ID [ID ...]
|
String |
xgroupCreate(String key,
String groupname,
StreamEntryID id,
boolean makeStream)
XGROUP CREATE
|
Long |
xgroupDelConsumer(String key,
String groupname,
String consumerName)
XGROUP DELCONSUMER
|
long |
xgroupDestroy(String key,
String groupname)
XGROUP DESTROY
|
String |
xgroupSetID(String key,
String groupname,
StreamEntryID id)
XGROUP SETID
|
List<StreamConsumersInfo> |
xinfoConsumers(String key,
String group)
Introspection command used in order to retrieve different information about consumers in the group
|
List<StreamGroupInfo> |
xinfoGroup(String key)
Introspection command used in order to retrieve different information about groups in the stream
|
StreamInfo |
xinfoStream(String key)
Introspection command used in order to retrieve different information about the stream
|
Long |
xlen(String key)
XLEN key
|
StreamPendingSummary |
xpending(String key,
String groupname)
XPENDING key group
|
List<StreamPendingEntry> |
xpending(String key,
String groupname,
StreamEntryID start,
StreamEntryID end,
int count,
String consumername)
XPENDING key group [start end count] [consumer]
|
List<StreamPendingEntry> |
xpending(String key,
String groupname,
XPendingParams params)
XPENDING key group [[IDLE min-idle-time] start end count [consumer]]
|
List<StreamEntry> |
xrange(String key,
StreamEntryID start,
StreamEntryID end)
XRANGE key start end
WARNING: Sending untyped null for both start and end would raise compilation error.
|
List<StreamEntry> |
xrange(String key,
StreamEntryID start,
StreamEntryID end,
int count)
XRANGE key start end COUNT count
WARNING: Sending untyped null for both start and end would raise compilation error.
|
List<Map.Entry<String,List<StreamEntry>>> |
xread(int count,
long block,
Map.Entry<String,StreamEntryID>... streams)
XREAD [COUNT count] [BLOCK milliseconds] STREAMS key [key ...] ID [ID ...]
|
List<Map.Entry<String,List<StreamEntry>>> |
xread(XReadParams xReadParams,
Map<String,StreamEntryID> streams) |
List<Map.Entry<String,List<StreamEntry>>> |
xreadGroup(String groupname,
String consumer,
int count,
long block,
boolean noAck,
Map.Entry<String,StreamEntryID>... streams)
XREAD [COUNT count] [BLOCK milliseconds] STREAMS key [key ...] ID [ID ...]
|
List<Map.Entry<String,List<StreamEntry>>> |
xreadGroup(String groupname,
String consumer,
XReadGroupParams xReadGroupParams,
Map<String,StreamEntryID> streams) |
List<StreamEntry> |
xrevrange(String key,
StreamEntryID end,
StreamEntryID start)
XREVRANGE key end start
WARNING: Sending untyped null for both start and end would raise compilation error.
|
List<StreamEntry> |
xrevrange(String key,
StreamEntryID end,
StreamEntryID start,
int count)
XREVRANGE key end start COUNT count
WARNING: Sending untyped null for both start and end would raise compilation error.
|
long |
xtrim(String key,
long maxLen,
boolean approximateLength)
XTRIM key MAXLEN [~] count
|
long |
xtrim(String key,
XTrimParams params)
XTRIM key MAXLEN|MINID [=|~] threshold [LIMIT count]
|
Long |
zadd(String key,
double score,
String member)
Add the specified member having the specified score to the sorted set stored at key.
|
Long |
zadd(String key,
double score,
String member,
ZAddParams params) |
Long |
zadd(String key,
Map<String,Double> scoreMembers) |
Long |
zadd(String key,
Map<String,Double> scoreMembers,
ZAddParams params) |
Double |
zaddIncr(String key,
double score,
String member,
ZAddParams params) |
Long |
zcard(String key)
Return the sorted set cardinality (number of elements).
|
Long |
zcount(String key,
double min,
double max) |
Long |
zcount(String key,
String min,
String max) |
Set<String> |
zdiff(String... keys) |
Long |
zdiffStore(String dstkey,
String... keys) |
Set<Tuple> |
zdiffWithScores(String... keys) |
Double |
zincrby(String key,
double increment,
String member)
If member already exists in the sorted set adds the increment to its score and updates the
position of the element in the sorted set accordingly.
|
Double |
zincrby(String key,
double increment,
String member,
ZIncrByParams params) |
Set<String> |
zinter(ZParams params,
String... keys)
Intersect multiple sorted sets, This command is similar to ZINTERSTORE, but instead of storing
the resulting sorted set, it is returned to the client.
|
Long |
zinterstore(String dstkey,
String... sets)
Creates a union or intersection of N sorted sets given by keys k1 through kN, and stores it at
dstkey.
|
Long |
zinterstore(String dstkey,
ZParams params,
String... sets)
Creates a union or intersection of N sorted sets given by keys k1 through kN, and stores it at
dstkey.
|
Set<Tuple> |
zinterWithScores(ZParams params,
String... keys)
Intersect multiple sorted sets, This command is similar to ZINTERSTORE, but instead of storing
the resulting sorted set, it is returned to the client.
|
Long |
zlexcount(String key,
String min,
String max) |
List<Double> |
zmscore(String key,
String... members)
Returns the scores associated with the specified members in the sorted set stored at key.
|
Tuple |
zpopmax(String key) |
Set<Tuple> |
zpopmax(String key,
int count) |
Tuple |
zpopmin(String key) |
Set<Tuple> |
zpopmin(String key,
int count) |
String |
zrandmember(String key) |
Set<String> |
zrandmember(String key,
long count) |
Set<Tuple> |
zrandmemberWithScores(String key,
long count) |
Set<String> |
zrange(String key,
long start,
long stop) |
Set<String> |
zrangeByLex(String key,
String min,
String max) |
Set<String> |
zrangeByLex(String key,
String min,
String max,
int offset,
int count) |
Set<String> |
zrangeByScore(String key,
double min,
double max)
Return the all the elements in the sorted set at key with a score between min and max
(including elements with score equal to min or max).
|
Set<String> |
zrangeByScore(String key,
double min,
double max,
int offset,
int count)
Return the all the elements in the sorted set at key with a score between min and max
(including elements with score equal to min or max).
|
Set<String> |
zrangeByScore(String key,
String min,
String max) |
Set<String> |
zrangeByScore(String key,
String min,
String max,
int offset,
int count) |
Set<Tuple> |
zrangeByScoreWithScores(String key,
double min,
double max)
Return the all the elements in the sorted set at key with a score between min and max
(including elements with score equal to min or max).
|
Set<Tuple> |
zrangeByScoreWithScores(String key,
double min,
double max,
int offset,
int count)
Return the all the elements in the sorted set at key with a score between min and max
(including elements with score equal to min or max).
|
Set<Tuple> |
zrangeByScoreWithScores(String key,
String min,
String max) |
Set<Tuple> |
zrangeByScoreWithScores(String key,
String min,
String max,
int offset,
int count) |
Set<Tuple> |
zrangeWithScores(String key,
long start,
long stop) |
Long |
zrank(String key,
String member)
Return the rank (or index) of member in the sorted set at key, with scores being ordered from
low to high.
|
Long |
zrem(String key,
String... members)
Remove the specified member from the sorted set value stored at key.
|
Long |
zremrangeByLex(String key,
String min,
String max) |
Long |
zremrangeByRank(String key,
long start,
long stop)
Remove all elements in the sorted set at key with rank between start and end.
|
Long |
zremrangeByScore(String key,
double min,
double max)
Remove all the elements in the sorted set at key with a score between min and max (including
elements with score equal to min or max).
|
Long |
zremrangeByScore(String key,
String min,
String max) |
Set<String> |
zrevrange(String key,
long start,
long stop) |
Set<String> |
zrevrangeByLex(String key,
String max,
String min) |
Set<String> |
zrevrangeByLex(String key,
String max,
String min,
int offset,
int count) |
Set<String> |
zrevrangeByScore(String key,
double max,
double min) |
Set<String> |
zrevrangeByScore(String key,
double max,
double min,
int offset,
int count) |
Set<String> |
zrevrangeByScore(String key,
String max,
String min) |
Set<String> |
zrevrangeByScore(String key,
String max,
String min,
int offset,
int count) |
Set<Tuple> |
zrevrangeByScoreWithScores(String key,
double max,
double min) |
Set<Tuple> |
zrevrangeByScoreWithScores(String key,
double max,
double min,
int offset,
int count) |
Set<Tuple> |
zrevrangeByScoreWithScores(String key,
String max,
String min) |
Set<Tuple> |
zrevrangeByScoreWithScores(String key,
String max,
String min,
int offset,
int count) |
Set<Tuple> |
zrevrangeWithScores(String key,
long start,
long stop) |
Long |
zrevrank(String key,
String member)
Return the rank (or index) of member in the sorted set at key, with scores being ordered from
high to low.
|
ScanResult<Tuple> |
zscan(String key,
String cursor) |
ScanResult<Tuple> |
zscan(String key,
String cursor,
ScanParams params) |
Double |
zscore(String key,
String member)
Return the score of the specified element of the sorted set at key.
|
Set<String> |
zunion(ZParams params,
String... keys)
Add multiple sorted sets, This command is similar to ZUNIONSTORE, but instead of storing the
resulting sorted set, it is returned to the client.
|
Long |
zunionstore(String dstkey,
String... sets)
Creates a union or intersection of N sorted sets given by keys k1 through kN, and stores it at
dstkey.
|
Long |
zunionstore(String dstkey,
ZParams params,
String... sets)
Creates a union or intersection of N sorted sets given by keys k1 through kN, and stores it at
dstkey.
|
Set<Tuple> |
zunionWithScores(ZParams params,
String... keys)
Add multiple sorted sets with scores, This command is similar to ZUNIONSTORE, but instead of storing the
resulting sorted set, it is returned to the client.
|
aclCat, aclCatBinary, aclDelUser, aclGenPassBinary, aclGetUser, aclListBinary, aclLog, aclLogBinary, aclLogBinary, aclLogReset, aclSetUser, aclSetUser, aclUsersBinary, aclWhoAmIBinary, append, auth, auth, bgrewriteaof, bgsave, bitcount, bitcount, bitfield, bitfieldReadonly, bitop, bitpos, bitpos, blmove, blpop, blpop, blpop, brpop, brpop, brpop, brpoplpush, bzpopmax, bzpopmin, checkIsInMultiOrPipeline, clientGetnameBinary, clientInfoBinary, clientKill, clientKill, clientKill, clientListBinary, clientListBinary, clientListBinary, clientPause, clientPause, clientSetname, configGet, configResetStat, configRewrite, configSet, configSetBinary, connect, copy, copy, dbSize, debug, decr, decrBy, del, del, disconnect, dump, echo, eval, eval, eval, eval, evalsha, evalsha, evalsha, exists, exists, expire, expireAt, failover, failover, failoverAbort, flushAll, flushAll, flushDB, flushDB, geoadd, geoadd, geoadd, geodist, geodist, geohash, geopos, georadius, georadius, georadiusByMember, georadiusByMember, georadiusByMemberReadonly, georadiusByMemberReadonly, georadiusByMemberStore, georadiusReadonly, georadiusReadonly, georadiusStore, get, getbit, getClient, getDB, getDel, getEx, getParamsWithBinary, getrange, getSet, getTupledSet, hdel, hexists, hget, hgetAll, hincrBy, hincrByFloat, hkeys, hlen, hmget, hmset, hrandfield, hrandfield, hrandfieldWithValues, hscan, hscan, hset, hset, hsetnx, hstrlen, hvals, incr, incrBy, incrByFloat, info, info, isBroken, isConnected, keys, lastsave, lindex, linsert, llen, lmove, lpop, lpop, lpos, lpos, lpos, lpush, lpushx, lrange, lrem, lset, ltrim, memoryDoctorBinary, memoryUsage, memoryUsage, mget, migrate, migrate, monitor, move, mset, msetnx, multi, objectEncoding, objectFreq, objectHelpBinary, objectIdletime, objectRefcount, persist, pexpire, pexpireAt, pfadd, pfcount, pfcount, pfmerge, ping, ping, pipelined, psetex, psubscribe, pttl, publish, quit, randomBinaryKey, rename, renamenx, resetState, restore, restore, restoreReplace, roleBinary, rpop, rpop, rpoplpush, rpush, rpushx, sadd, save, scan, scan, scan, scard, scriptExists, scriptExists, scriptFlush, scriptFlush, scriptKill, scriptLoad, sdiff, sdiffstore, select, sendBlockingCommand, sendCommand, sendCommand, set, set, setbit, setbit, setex, setnx, setrange, shutdown, shutdown, sinter, sinterstore, sismember, slaveof, slaveofNoOne, slowlogGetBinary, slowlogGetBinary, slowlogLen, slowlogReset, smembers, smismember, smove, sort, sort, sort, sort, spop, spop, srandmember, srandmember, srem, sscan, sscan, strAlgoLCSKeys, strAlgoLCSStrings, strlen, subscribe, substr, sunion, sunionstore, swapDB, sync, time, toString, touch, touch, ttl, type, unlink, unlink, unwatch, waitReplicas, watch, xack, xadd, xadd, xautoclaim, xautoclaimJustId, xclaim, xclaim, xclaimJustId, xdel, xgroupCreate, xgroupDelConsumer, xgroupDestroy, xgroupSetID, xinfoConsumers, xinfoConsumersBinary, xinfoGroup, xinfoGroupBinary, xinfoStream, xinfoStreamBinary, xlen, xpending, xpending, xpending, xrange, xrange, xread, xread, xreadGroup, xreadGroup, xrevrange, xrevrange, xtrim, xtrim, zadd, zadd, zadd, zadd, zaddIncr, zcard, zcount, zcount, zdiff, zdiffStore, zdiffWithScores, zincrby, zincrby, zinter, zinterstore, zinterstore, zinterWithScores, zlexcount, zmscore, zpopmax, zpopmax, zpopmin, zpopmin, zrandmember, zrandmember, zrandmemberWithScores, zrange, zrangeByLex, zrangeByLex, zrangeByScore, zrangeByScore, zrangeByScore, zrangeByScore, zrangeByScoreWithScores, zrangeByScoreWithScores, zrangeByScoreWithScores, zrangeByScoreWithScores, zrangeWithScores, zrank, zrem, zremrangeByLex, zremrangeByRank, zremrangeByScore, zremrangeByScore, zrevrange, zrevrangeByLex, zrevrangeByLex, zrevrangeByScore, zrevrangeByScore, zrevrangeByScore, zrevrangeByScore, zrevrangeByScoreWithScores, zrevrangeByScoreWithScores, zrevrangeByScoreWithScores, zrevrangeByScoreWithScores, zrevrangeWithScores, zrevrank, zscan, zscan, zscore, zunion, zunionstore, zunionstore, zunionWithScores
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
expire, restore, restoreReplace, setex
unwatch
aclLogReset, clientKill, clientKill, clientPause, clientPause, failover, failover, failoverAbort, slowlogLen, slowlogReset
auth, auth, bgrewriteaof, bgsave, configResetStat, configRewrite, dbSize, debug, flushAll, flushAll, flushDB, flushDB, getDB, info, info, lastsave, ping, quit, save, select, shutdown, shutdown, slaveof, slaveofNoOne, swapDB, waitReplicas
clusterFailover
expire, restore, restoreReplace, setex, xrange
@Deprecated protected JedisPoolAbstract dataSource
public Jedis()
@Deprecated public Jedis(String uri)
JedisURIHelper#isValid(java.net.URI)
can used before this. If this
constructor was being used with a host, it can be replaced with
Jedis(java.lang.String, int)
with the host and Protocol.DEFAULT_PORT
.uri
- public Jedis(HostAndPort hp)
public Jedis(HostAndPort hp, JedisClientConfig config)
public Jedis(String host, int port)
public Jedis(String host, int port, boolean ssl)
public Jedis(String host, int port, boolean ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
public Jedis(String host, int port, int timeout)
public Jedis(String host, int port, int timeout, boolean ssl)
public Jedis(String host, int port, int timeout, boolean ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
public Jedis(String host, int port, int connectionTimeout, int soTimeout)
public Jedis(String host, int port, int connectionTimeout, int soTimeout, int infiniteSoTimeout)
public Jedis(String host, int port, int connectionTimeout, int soTimeout, boolean ssl)
public Jedis(String host, int port, int connectionTimeout, int soTimeout, boolean ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
public Jedis(String host, int port, int connectionTimeout, int soTimeout, int infiniteSoTimeout, boolean ssl, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
public Jedis(JedisShardInfo shardInfo)
public Jedis(URI uri)
public Jedis(URI uri, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
public Jedis(URI uri, int timeout)
public Jedis(URI uri, int timeout, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
public Jedis(URI uri, int connectionTimeout, int soTimeout)
public Jedis(URI uri, int connectionTimeout, int soTimeout, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
public Jedis(URI uri, int connectionTimeout, int soTimeout, int infiniteSoTimeout, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier)
public Jedis(URI uri, JedisClientConfig config)
@Deprecated public Jedis(JedisSocketFactory jedisSocketFactory)
Jedis(redis.clients.jedis.JedisSocketFactory, redis.clients.jedis.JedisClientConfig)
.public Jedis(JedisSocketFactory jedisSocketFactory, JedisClientConfig clientConfig)
public Boolean copy(String srcKey, String dstKey, int db, boolean replace)
copy
in interface MultiKeyCommands
srcKey
- the source key.dstKey
- the destination key.db
- replace
- public Boolean copy(String srcKey, String dstKey, boolean replace)
copy
in interface MultiKeyCommands
srcKey
- the source key.dstKey
- the destination key.replace
- public String ping(String message)
message
- public String set(String key, String value)
Time complexity: O(1)
set
in interface JedisCommands
key
- value
- public String set(String key, String value, SetParams params)
set
in interface JedisCommands
key
- value
- params
- NX|XX, NX -- Only set the key if it does not already exist. XX -- Only set the
key if it already exist. EX|PX, expire time units: EX = seconds; PX = millisecondspublic String get(String key)
Time complexity: O(1)
get
in interface JedisCommands
key
- public String getDel(String key)
Time complexity: O(1)
getDel
in interface JedisCommands
key
- public String getEx(String key, GetExParams params)
getEx
in interface JedisCommands
public Long exists(String... keys)
exists
in interface MultiKeyCommands
keys
- public Boolean exists(String key)
exists
in interface JedisCommands
key
- public Long del(String... keys)
del
in interface MultiKeyCommands
keys
- public Long del(String key)
del
in interface JedisCommands
public Long unlink(String... keys)
Time complexity: O(1) for each key removed regardless of its size. Then the command does O(N) work in a different thread in order to reclaim memory, where N is the number of allocations the deleted objects where composed of.
unlink
in interface MultiKeyCommands
keys
- public Long unlink(String key)
unlink
in interface JedisCommands
public String type(String key)
type
in interface JedisCommands
key
- public Set<String> keys(String pattern)
MultiKeyCommands
MultiKeyCommands.scan(String, ScanParams)
or sets.
While the time complexity for this operation is O(N), the constant times are fairly low. For example, Redis running on an entry level laptop can scan a 1 million key database in 40 milliseconds.
Glob style patterns examples:
Use \ to escape special chars if you want to match them verbatim.
Time complexity: O(n) (with n being the number of keys in the DB, and assuming keys and pattern of limited length)
keys
in interface MultiKeyCommands
public String randomKey()
Time complexity: O(1)
randomKey
in interface MultiKeyCommands
public String rename(String oldkey, String newkey)
Time complexity: O(1)
rename
in interface MultiKeyCommands
oldkey
- newkey
- public Long renamenx(String oldkey, String newkey)
Time complexity: O(1)
renamenx
in interface MultiKeyCommands
oldkey
- newkey
- public Long expire(String key, long seconds)
Volatile keys are stored on disk like the other keys, the timeout is persistent too like all the other aspects of the dataset. Saving a dataset containing expires and stopping the server does not stop the flow of time as Redis stores on disk the time when the key will no longer be available as Unix time, and not the remaining seconds.
Since Redis 2.1.3 you can update the value of the timeout of a key already having an expire
set. It is also possible to undo the expire at all turning the key into a normal key using the
PERSIST
command.
Time complexity: O(1)
expire
in interface JedisCommands
key
- seconds
- public Long expireAt(String key, long unixTime)
EXPIRE
but instead to get the number
of seconds representing the Time To Live of the key as a second argument (that is a relative
way of specifying the TTL), it takes an absolute one in the form of a UNIX timestamp (Number of
seconds elapsed since 1 Gen 1970).
EXPIREAT was introduced in order to implement the Append Only File persistence mode so that EXPIRE commands are automatically translated into EXPIREAT commands for the append only file. Of course EXPIREAT can also used by programmers that need a way to simply specify that a given key should expire at a given time in the future.
Since Redis 2.1.3 you can update the value of the timeout of a key already having an expire
set. It is also possible to undo the expire at all turning the key into a normal key using the
PERSIST
command.
Time complexity: O(1)
expireAt
in interface JedisCommands
key
- unixTime
- public Long ttl(String key)
EXPIRE
set. This introspection capability allows a Redis client to
check how many seconds a given key will continue to be part of the dataset.ttl
in interface JedisCommands
key
- public Long touch(String... keys)
touch
in interface MultiKeyCommands
keys
- public Long touch(String key)
touch
in interface JedisCommands
public Long move(String key, int dbIndex)
move
in interface JedisCommands
key
- dbIndex
- public String getSet(String key, String value)
Time complexity: O(1)
getSet
in interface JedisCommands
key
- value
- public List<String> mget(String... keys)
Time complexity: O(1) for every key
mget
in interface MultiKeyCommands
keys
- public Long setnx(String key, String value)
SET
with the only difference that if the
key already exists no operation is performed. SETNX actually means "SET if Not eXists".
Time complexity: O(1)
setnx
in interface JedisCommands
key
- value
- public String setex(String key, long seconds, String value)
SET
+ EXPIRE
. The operation is
atomic.
Time complexity: O(1)
setex
in interface JedisCommands
key
- seconds
- value
- public String mset(String... keysvalues)
MSETNX
will not perform any operation at all even if
just a single key already exists.
Because of this semantic MSETNX can be used in order to set different keys representing different fields of an unique logic object in a way that ensures that either all the fields or none at all are set.
Both MSET and MSETNX are atomic operations. This means that for instance if the keys A and B are modified, another client talking to Redis can either see the changes to both A and B at once, or no modification at all.
mset
in interface MultiKeyCommands
keysvalues
- msetnx(String...)
public Long msetnx(String... keysvalues)
MSET
will
replace old values with new values, while MSETNX will not perform any operation at all even if
just a single key already exists.
Because of this semantic MSETNX can be used in order to set different keys representing different fields of an unique logic object in a way that ensures that either all the fields or none at all are set.
Both MSET and MSETNX are atomic operations. This means that for instance if the keys A and B are modified, another client talking to Redis can either see the changes to both A and B at once, or no modification at all.
msetnx
in interface MultiKeyCommands
keysvalues
- mset(String...)
public Long decrBy(String key, long decrement)
INCR
but instead to decrement by 1 the decrement
is integer.
INCR commands are limited to 64 bit signed integers.
Note: this is actually a string operation, that is, in Redis there are not "integer" types. Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented, and then converted back as a string.
Time complexity: O(1)
decrBy
in interface JedisCommands
key
- decrement
- incr(String)
,
decr(String)
,
incrBy(String, long)
public Long decr(String key)
INCR commands are limited to 64 bit signed integers.
Note: this is actually a string operation, that is, in Redis there are not "integer" types. Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented, and then converted back as a string.
Time complexity: O(1)
decr
in interface JedisCommands
key
- incr(String)
,
incrBy(String, long)
,
decrBy(String, long)
public Long incrBy(String key, long increment)
INCR
but instead to increment by 1 the increment is
integer.
INCR commands are limited to 64 bit signed integers.
Note: this is actually a string operation, that is, in Redis there are not "integer" types. Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented, and then converted back as a string.
Time complexity: O(1)
incrBy
in interface JedisCommands
key
- increment
- incr(String)
,
decr(String)
,
decrBy(String, long)
public Double incrByFloat(String key, double increment)
INCRBYFLOAT commands are limited to double precision floating point values.
Note: this is actually a string operation, that is, in Redis there are not "double" types. Simply the string stored at the key is parsed as a base double precision floating point value, incremented, and then converted back as a string. There is no DECRYBYFLOAT but providing a negative value will work as expected.
Time complexity: O(1)
incrByFloat
in interface JedisCommands
key
- increment
- public Long incr(String key)
INCR commands are limited to 64 bit signed integers.
Note: this is actually a string operation, that is, in Redis there are not "integer" types. Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented, and then converted back as a string.
Time complexity: O(1)
incr
in interface JedisCommands
key
- incrBy(String, long)
,
decr(String)
,
decrBy(String, long)
public Long append(String key, String value)
Time complexity: O(1). The amortized time complexity is O(1) assuming the appended value is small and the already present value is of any size, since the dynamic string library used by Redis will double the free space available on every reallocation.
append
in interface JedisCommands
key
- value
- public String substr(String key, int start, int end)
The function handles out of range requests without raising an error, but just limiting the resulting range to the actual length of the string.
Time complexity: O(start+n) (with start being the start index and n the total length of the requested range). Note that the lookup part of this command is O(1) so for small strings this is actually an O(1) command.
substr
in interface JedisCommands
key
- start
- end
- public Long hset(String key, String field, String value)
If key does not exist, a new key holding a hash is created.
Time complexity: O(1)
hset
in interface JedisCommands
key
- field
- value
- public Long hset(String key, Map<String,String> hash)
hset
in interface JedisCommands
public String hget(String key, String field)
If the field is not found or the key does not exist, a special 'nil' value is returned.
Time complexity: O(1)
hget
in interface JedisCommands
key
- field
- public Long hsetnx(String key, String field, String value)
hsetnx
in interface JedisCommands
key
- field
- value
- public String hmset(String key, Map<String,String> hash)
If key does not exist, a new key holding a hash is created.
Time complexity: O(N) (with N being the number of fields)
hmset
in interface JedisCommands
key
- hash
- public List<String> hmget(String key, String... fields)
If some of the specified fields do not exist, nil values are returned. Non existing keys are considered like empty hashes.
Time complexity: O(N) (with N being the number of fields)
hmget
in interface JedisCommands
key
- fields
- public Long hincrBy(String key, String field, long value)
The range of values supported by HINCRBY is limited to 64 bit signed integers.
Time complexity: O(1)
hincrBy
in interface JedisCommands
key
- field
- value
- public Double hincrByFloat(String key, String field, double value)
The range of values supported by HINCRBYFLOAT is limited to double precision floating point values.
Time complexity: O(1)
hincrByFloat
in interface JedisCommands
key
- field
- value
- public Boolean hexists(String key, String field)
hexists
in interface JedisCommands
key
- field
- public Long hdel(String key, String... fields)
Time complexity: O(1)
hdel
in interface JedisCommands
key
- fields
- public Long hlen(String key)
Time complexity: O(1)
hlen
in interface JedisCommands
key
- public Set<String> hkeys(String key)
Time complexity: O(N), where N is the total number of entries
hkeys
in interface JedisCommands
key
- public List<String> hvals(String key)
Time complexity: O(N), where N is the total number of entries
hvals
in interface JedisCommands
key
- public Map<String,String> hgetAll(String key)
Time complexity: O(N), where N is the total number of entries
hgetAll
in interface JedisCommands
key
- public String hrandfield(String key)
Time complexity: O(N), where N is the number of fields returned
hrandfield
in interface JedisCommands
key
- public List<String> hrandfield(String key, long count)
Time complexity: O(N), where N is the number of fields returned
hrandfield
in interface JedisCommands
key
- count
- public Map<String,String> hrandfieldWithValues(String key, long count)
Time complexity: O(N), where N is the number of fields returned
hrandfieldWithValues
in interface JedisCommands
key
- count
- public Long rpush(String key, String... strings)
Time complexity: O(1)
rpush
in interface JedisCommands
key
- strings
- public Long lpush(String key, String... strings)
Time complexity: O(1)
lpush
in interface JedisCommands
key
- strings
- public Long llen(String key)
Time complexity: O(1)
llen
in interface JedisCommands
key
- public List<String> lrange(String key, long start, long stop)
For example LRANGE foobar 0 2 will return the first three elements of the list.
start and end can also be negative numbers indicating offsets from the end of the list. For example -1 is the last element of the list, -2 the penultimate element and so on.
Consistency with range functions in various programming languages
Note that if you have a list of numbers from 0 to 100, LRANGE 0 10 will return 11 elements, that is, rightmost item is included. This may or may not be consistent with behavior of range-related functions in your programming language of choice (think Ruby's Range.new, Array#slice or Python's range() function).
LRANGE behavior is consistent with one of Tcl.
Out-of-range indexes
Indexes out of range will not produce an error: if start is over the end of the list, or start > end, an empty list is returned. If end is over the end of the list Redis will threat it just like the last element of the list.
Time complexity: O(start+n) (with n being the length of the range and start being the start offset)
lrange
in interface JedisCommands
key
- start
- stop
- public String ltrim(String key, long start, long stop)
For example LTRIM foobar 0 2 will modify the list stored at foobar key so that only the first three elements of the list will remain.
start and end can also be negative numbers indicating offsets from the end of the list. For example -1 is the last element of the list, -2 the penultimate element and so on.
Indexes out of range will not produce an error: if start is over the end of the list, or start > end, an empty list is left as value. If end over the end of the list Redis will threat it just like the last element of the list.
Hint: the obvious use of LTRIM is together with LPUSH/RPUSH. For example:
lpush("mylist", "someelement"); ltrim("mylist", 0, 99); *
The above two commands will push elements in the list taking care that the list will not grow without limits. This is very useful when using Redis to store logs for example. It is important to note that when used in this way LTRIM is an O(1) operation because in the average case just one element is removed from the tail of the list.
Time complexity: O(n) (with n being len of list - len of range)
ltrim
in interface JedisCommands
key
- start
- stop
- public String lindex(String key, long index)
If the value stored at key is not of list type an error is returned. If the index is out of range a 'nil' reply is returned.
Note that even if the average time complexity is O(n) asking for the first or the last element of the list is O(1).
Time complexity: O(n) (with n being the length of the list)
lindex
in interface JedisCommands
key
- index
- public String lset(String key, long index, String value)
Out of range indexes will generate an error.
Similarly to other list commands accepting indexes, the index can be negative to access elements starting from the end of the list. So -1 is the last element, -2 is the penultimate, and so forth.
Time complexity:
O(N) (with N being the length of the list), setting the first or last elements of the list is O(1).
lset
in interface JedisCommands
key
- index
- value
- lindex(String, long)
public Long lrem(String key, long count, String value)
Time complexity: O(N) (with N being the length of the list)
lrem
in interface JedisCommands
key
- count
- value
- public String lpop(String key)
If the key does not exist or the list is already empty the special value 'nil' is returned.
lpop
in interface JedisCommands
key
- rpop(String)
public List<String> lpop(String key, int count)
lpop
in interface JedisCommands
public Long lpos(String key, String element)
lpos
in interface JedisCommands
public Long lpos(String key, String element, LPosParams params)
lpos
in interface JedisCommands
public List<Long> lpos(String key, String element, LPosParams params, long count)
lpos
in interface JedisCommands
public String rpop(String key)
If the key does not exist or the list is already empty the special value 'nil' is returned.
rpop
in interface JedisCommands
key
- lpop(String)
public List<String> rpop(String key, int count)
rpop
in interface JedisCommands
public String rpoplpush(String srckey, String dstkey)
If the key does not exist or the list is already empty the special value 'nil' is returned. If the srckey and dstkey are the same the operation is equivalent to removing the last element from the list and pushing it as first element of the list, so it's a "list rotation" command.
Time complexity: O(1)
rpoplpush
in interface MultiKeyCommands
srckey
- dstkey
- public Long sadd(String key, String... members)
Time complexity O(1)
sadd
in interface JedisCommands
key
- members
- public Set<String> smembers(String key)
SINTER
.
Time complexity O(N)
smembers
in interface JedisCommands
key
- public Long srem(String key, String... members)
Time complexity O(1)
srem
in interface JedisCommands
key
- members
- public String spop(String key)
The srandmember(String)
command does a similar work but the returned element is not
removed from the Set.
Time complexity O(1)
spop
in interface JedisCommands
key
- public Set<String> spop(String key, long count)
spop
in interface JedisCommands
public Long smove(String srckey, String dstkey, String member)
If the source set does not exist or does not contain the specified element no operation is performed and zero is returned, otherwise the element is removed from the source set and added to the destination set. On success one is returned, even if the element was already present in the destination set.
An error is raised if the source or destination keys contain a non Set value.
Time complexity O(1)
smove
in interface MultiKeyCommands
srckey
- dstkey
- member
- public Long scard(String key)
scard
in interface JedisCommands
key
- public Boolean sismember(String key, String member)
Time complexity O(1)
sismember
in interface JedisCommands
key
- member
- public List<Boolean> smismember(String key, String... members)
Time complexity O(N) where N is the number of elements being checked for membership
smismember
in interface JedisCommands
key
- members
- public Set<String> sinter(String... keys)
LRANGE
the result is sent to the
client as a multi-bulk reply (see the protocol specification for more information). If just a
single key is specified, then this command produces the same result as
SMEMBERS
. Actually SMEMBERS is just syntax sugar for SINTER.
Non existing keys are considered like empty sets, so if one of the keys is missing an empty set is returned (since the intersection with an empty set always is an empty set).
Time complexity O(N*M) worst case where N is the cardinality of the smallest set and M the number of sets
sinter
in interface MultiKeyCommands
keys
- public Long sinterstore(String dstkey, String... keys)
SINTER
but instead of being returned
the resulting set is stored as dstkey.
Time complexity O(N*M) worst case where N is the cardinality of the smallest set and M the number of sets
sinterstore
in interface MultiKeyCommands
dstkey
- keys
- public Set<String> sunion(String... keys)
LRANGE
the result is sent to the client as a
multi-bulk reply (see the protocol specification for more information). If just a single key is
specified, then this command produces the same result as SMEMBERS
.
Non existing keys are considered like empty sets.
Time complexity O(N) where N is the total number of elements in all the provided sets
sunion
in interface MultiKeyCommands
keys
- public Long sunionstore(String dstkey, String... keys)
SUNION
but instead of being returned
the resulting set is stored as dstkey. Any existing value in dstkey will be over-written.
Time complexity O(N) where N is the total number of elements in all the provided sets
sunionstore
in interface MultiKeyCommands
dstkey
- keys
- public Set<String> sdiff(String... keys)
Example:
key1 = [x, a, b, c] key2 = [c] key3 = [a, d] SDIFF key1,key2,key3 => [x, b]Non existing keys are considered like empty sets.
Time complexity:
O(N) with N being the total number of elements of all the sets
sdiff
in interface MultiKeyCommands
keys
- public Long sdiffstore(String dstkey, String... keys)
SDIFF
but instead of being returned
the resulting set is stored in dstkey.sdiffstore
in interface MultiKeyCommands
dstkey
- keys
- public String srandmember(String key)
The SPOP command does a similar work but the returned element is popped (removed) from the Set.
Time complexity O(1)
srandmember
in interface JedisCommands
key
- public List<String> srandmember(String key, int count)
The SPOP command does a similar work but the returned elements is popped (removed) from the Set.
Time complexity O(1)
srandmember
in interface JedisCommands
key
- count
- if positive, return an array of distinct elements.
If negative the behavior changes and the command is allowed to
return the same element multiple timespublic Long zadd(String key, double score, String member)
The score value can be the string representation of a double precision floating point number.
Time complexity O(log(N)) with N being the number of elements in the sorted set
zadd
in interface JedisCommands
key
- score
- member
- public Long zadd(String key, double score, String member, ZAddParams params)
zadd
in interface JedisCommands
public Long zadd(String key, Map<String,Double> scoreMembers)
zadd
in interface JedisCommands
public Long zadd(String key, Map<String,Double> scoreMembers, ZAddParams params)
zadd
in interface JedisCommands
public Double zaddIncr(String key, double score, String member, ZAddParams params)
zaddIncr
in interface JedisCommands
public Set<String> zdiff(String... keys)
zdiff
in interface MultiKeyCommands
public Set<Tuple> zdiffWithScores(String... keys)
zdiffWithScores
in interface MultiKeyCommands
public Long zdiffStore(String dstkey, String... keys)
zdiffStore
in interface MultiKeyCommands
public Set<String> zrange(String key, long start, long stop)
zrange
in interface JedisCommands
public Long zrem(String key, String... members)
Time complexity O(log(N)) with N being the number of elements in the sorted set
zrem
in interface JedisCommands
key
- members
- public Double zincrby(String key, double increment, String member)
The score value can be the string representation of a double precision floating point number. It's possible to provide a negative value to perform a decrement.
For an introduction to sorted sets check the Introduction to Redis data types page.
Time complexity O(log(N)) with N being the number of elements in the sorted set
zincrby
in interface JedisCommands
key
- increment
- member
- public Double zincrby(String key, double increment, String member, ZIncrByParams params)
zincrby
in interface JedisCommands
public Long zrank(String key, String member)
When the given member does not exist in the sorted set, the special value 'nil' is returned. The returned rank (or index) of the member is 0-based for both commands.
Time complexity:
O(log(N))
zrank
in interface JedisCommands
key
- member
- zrevrank(String, String)
public Long zrevrank(String key, String member)
When the given member does not exist in the sorted set, the special value 'nil' is returned. The returned rank (or index) of the member is 0-based for both commands.
Time complexity:
O(log(N))
zrevrank
in interface JedisCommands
key
- member
- zrank(String, String)
public Set<String> zrevrange(String key, long start, long stop)
zrevrange
in interface JedisCommands
public Set<Tuple> zrangeWithScores(String key, long start, long stop)
zrangeWithScores
in interface JedisCommands
public Set<Tuple> zrevrangeWithScores(String key, long start, long stop)
zrevrangeWithScores
in interface JedisCommands
public String zrandmember(String key)
zrandmember
in interface JedisCommands
public Set<String> zrandmember(String key, long count)
zrandmember
in interface JedisCommands
public Set<Tuple> zrandmemberWithScores(String key, long count)
zrandmemberWithScores
in interface JedisCommands
public Long zcard(String key)
Time complexity O(1)
zcard
in interface JedisCommands
key
- public Double zscore(String key, String member)
Time complexity: O(1)
zscore
in interface JedisCommands
key
- member
- public List<Double> zmscore(String key, String... members)
Time complexity: O(N) where N is the number of members being requested.
zmscore
in interface JedisCommands
key
- members
- public Tuple zpopmax(String key)
zpopmax
in interface JedisCommands
public Set<Tuple> zpopmax(String key, int count)
zpopmax
in interface JedisCommands
public Tuple zpopmin(String key)
zpopmin
in interface JedisCommands
public Set<Tuple> zpopmin(String key, int count)
zpopmin
in interface JedisCommands
public String watch(String... keys)
watch
in interface MultiKeyCommands
public List<String> sort(String key)
Sort the elements contained in the List, Set, or Sorted Set value at key. By default sorting is numeric with elements being compared as double precision floating point numbers. This is the simplest form of SORT.
sort
in interface JedisCommands
key
- sort(String, String)
,
sort(String, SortingParams)
,
sort(String, SortingParams, String)
public List<String> sort(String key, SortingParams sortingParameters)
examples:
Given are the following sets and key/values:
x = [1, 2, 3] y = [a, b, c] k1 = z k2 = y k3 = x w1 = 9 w2 = 8 w3 = 7Sort Order:
sort(x) or sort(x, sp.asc()) -> [1, 2, 3] sort(x, sp.desc()) -> [3, 2, 1] sort(y) -> [c, a, b] sort(y, sp.alpha()) -> [a, b, c] sort(y, sp.alpha().desc()) -> [c, a, b]Limit (e.g. for Pagination):
sort(x, sp.limit(0, 2)) -> [1, 2] sort(y, sp.alpha().desc().limit(1, 2)) -> [b, a]Sorting by external keys:
sort(x, sb.by(w*)) -> [3, 2, 1] sort(x, sb.by(w*).desc()) -> [1, 2, 3]Getting external keys:
sort(x, sp.by(w*).get(k*)) -> [x, y, z] sort(x, sp.by(w*).get(#).get(k*)) -> [3, x, 2, y, 1, z]
sort
in interface JedisCommands
key
- sortingParameters
- sort(String)
,
sort(String, SortingParams, String)
public Long sort(String key, SortingParams sortingParameters, String dstkey)
sort
in interface MultiKeyCommands
key
- sortingParameters
- dstkey
- sort(String, SortingParams)
,
sort(String)
,
sort(String, String)
public Long sort(String key, String dstkey)
Sort the elements contained in the List, Set, or Sorted Set value at key and store the result at dstkey. By default sorting is numeric with elements being compared as double precision floating point numbers. This is the simplest form of SORT.
sort
in interface MultiKeyCommands
key
- dstkey
- sort(String)
,
sort(String, SortingParams)
,
sort(String, SortingParams, String)
public String lmove(String srcKey, String dstKey, ListDirection from, ListDirection to)
lmove
in interface MultiKeyCommands
public String blmove(String srcKey, String dstKey, ListDirection from, ListDirection to, double timeout)
blmove
in interface MultiKeyCommands
public List<String> blpop(int timeout, String... keys)
The following is a description of the exact semantic. We describe BLPOP but the two commands are identical, the only difference is that BLPOP pops the element from the left (head) of the list, and BRPOP pops from the right (tail).
Non blocking behavior
When BLPOP is called, if at least one of the specified keys contain a non empty list, an element is popped from the head of the list and returned to the caller together with the name of the key (BLPOP returns a two elements array, the first element is the key, the second the popped value).
Keys are scanned from left to right, so for instance if you issue BLPOP list1 list2 list3 0 against a dataset where list1 does not exist but list2 and list3 contain non empty lists, BLPOP guarantees to return an element from the list stored at list2 (since it is the first non empty list starting from the left).
Blocking behavior
If none of the specified keys exist or contain non empty lists, BLPOP blocks until some other client performs a LPUSH or an RPUSH operation against one of the lists.
Once new data is present on one of the lists, the client finally returns with the name of the key unblocking it and the popped value.
When blocking, if a non-zero timeout is specified, the client will unblock returning a nil special value if the specified amount of seconds passed without a push operation against at least one of the specified keys.
The timeout argument is interpreted as an integer value. A timeout of zero means instead to block forever.
Multiple clients blocking for the same keys
Multiple clients can block for the same key. They are put into a queue, so the first to be served will be the one that started to wait earlier, in a first-blpopping first-served fashion.
blocking POP inside a MULTI/EXEC transaction
BLPOP and BRPOP can be used with pipelining (sending multiple commands and reading the replies in batch), but it does not make sense to use BLPOP or BRPOP inside a MULTI/EXEC block (a Redis transaction).
The behavior of BLPOP inside MULTI/EXEC when the list is empty is to return a multi-bulk nil reply, exactly what happens when the timeout is reached. If you like science fiction, think at it like if inside MULTI/EXEC the time will flow at infinite speed :)
Time complexity: O(1)
blpop
in interface MultiKeyCommands
timeout
- keys
- When a non-zero timeout is specified, and the BLPOP operation timed out, the return value is a nil multi bulk reply. Most client values will return false or nil accordingly to the programming language used.
brpop(int, String...)
public KeyedListElement blpop(double timeout, String... keys)
blpop
in interface MultiKeyCommands
public List<String> brpop(int timeout, String... keys)
The following is a description of the exact semantic. We describe BLPOP but the two commands are identical, the only difference is that BLPOP pops the element from the left (head) of the list, and BRPOP pops from the right (tail).
Non blocking behavior
When BLPOP is called, if at least one of the specified keys contain a non empty list, an element is popped from the head of the list and returned to the caller together with the name of the key (BLPOP returns a two elements array, the first element is the key, the second the popped value).
Keys are scanned from left to right, so for instance if you issue BLPOP list1 list2 list3 0 against a dataset where list1 does not exist but list2 and list3 contain non empty lists, BLPOP guarantees to return an element from the list stored at list2 (since it is the first non empty list starting from the left).
Blocking behavior
If none of the specified keys exist or contain non empty lists, BLPOP blocks until some other client performs a LPUSH or an RPUSH operation against one of the lists.
Once new data is present on one of the lists, the client finally returns with the name of the key unblocking it and the popped value.
When blocking, if a non-zero timeout is specified, the client will unblock returning a nil special value if the specified amount of seconds passed without a push operation against at least one of the specified keys.
The timeout argument is interpreted as an integer value. A timeout of zero means instead to block forever.
Multiple clients blocking for the same keys
Multiple clients can block for the same key. They are put into a queue, so the first to be served will be the one that started to wait earlier, in a first-blpopping first-served fashion.
blocking POP inside a MULTI/EXEC transaction
BLPOP and BRPOP can be used with pipelining (sending multiple commands and reading the replies in batch), but it does not make sense to use BLPOP or BRPOP inside a MULTI/EXEC block (a Redis transaction).
The behavior of BLPOP inside MULTI/EXEC when the list is empty is to return a multi-bulk nil reply, exactly what happens when the timeout is reached. If you like science fiction, think at it like if inside MULTI/EXEC the time will flow at infinite speed :)
Time complexity: O(1)
brpop
in interface MultiKeyCommands
timeout
- keys
- When a non-zero timeout is specified, and the BLPOP operation timed out, the return value is a nil multi bulk reply. Most client values will return false or nil accordingly to the programming language used.
blpop(int, String...)
public KeyedListElement brpop(double timeout, String... keys)
brpop
in interface MultiKeyCommands
public List<String> blpop(String... args)
blpop
in interface MultiKeyCommands
public List<String> brpop(String... args)
brpop
in interface MultiKeyCommands
public KeyedZSetElement bzpopmax(double timeout, String... keys)
bzpopmax
in interface MultiKeyCommands
public KeyedZSetElement bzpopmin(double timeout, String... keys)
bzpopmin
in interface MultiKeyCommands
public List<String> blpop(int timeout, String key)
blpop
in interface JedisCommands
public KeyedListElement blpop(double timeout, String key)
blpop
in interface JedisCommands
public List<String> brpop(int timeout, String key)
brpop
in interface JedisCommands
public KeyedListElement brpop(double timeout, String key)
brpop
in interface JedisCommands
public Long zcount(String key, double min, double max)
zcount
in interface JedisCommands
public Long zcount(String key, String min, String max)
zcount
in interface JedisCommands
public Set<String> zrangeByScore(String key, double min, double max)
The elements having the same score are returned sorted lexicographically as ASCII strings (this follows from a property of Redis sorted sets and does not involve further computation).
Using the optional LIMIT
it's possible
to get only a range of the matching elements in an SQL-alike way. Note that if offset is large
the commands needs to traverse the list for offset elements and this adds up to the O(M)
figure.
The ZCOUNT
command is similar to
ZRANGEBYSCORE
but instead of returning the
actual elements in the specified interval, it just returns the number of matching elements.
Exclusive intervals and infinity
min and max can be -inf and +inf, so that you are not required to know what's the greatest or smallest element in order to take, for instance, elements "up to a given value".
Also while the interval is for default closed (inclusive) it's possible to specify open intervals prefixing the score with a "(" character, so for instance:
ZRANGEBYSCORE zset (1.3 5
Will return all the values with score > 1.3 and <= 5, while for instance:
ZRANGEBYSCORE zset (5 (10
Will return all the values with score > 5 and < 10 (5 and 10 excluded).
Time complexity:
O(log(N))+O(M) with N being the number of elements in the sorted set and M the number of elements returned by the command, so if M is constant (for instance you always ask for the first ten elements with LIMIT) you can consider it O(log(N))
zrangeByScore
in interface JedisCommands
key
- min
- a double or Double.NEGATIVE_INFINITY for "-inf"max
- a double or Double.POSITIVE_INFINITY for "+inf"zrangeByScore(String, double, double)
,
zrangeByScore(String, double, double, int, int)
,
zrangeByScoreWithScores(String, double, double)
,
zrangeByScoreWithScores(String, String, String)
,
zrangeByScoreWithScores(String, double, double, int, int)
,
zcount(String, double, double)
public Set<String> zrangeByScore(String key, String min, String max)
zrangeByScore
in interface JedisCommands
public Set<String> zrangeByScore(String key, double min, double max, int offset, int count)
The elements having the same score are returned sorted lexicographically as ASCII strings (this follows from a property of Redis sorted sets and does not involve further computation).
Using the optional LIMIT
it's possible
to get only a range of the matching elements in an SQL-alike way. Note that if offset is large
the commands needs to traverse the list for offset elements and this adds up to the O(M)
figure.
The ZCOUNT
command is similar to
ZRANGEBYSCORE
but instead of returning the
actual elements in the specified interval, it just returns the number of matching elements.
Exclusive intervals and infinity
min and max can be -inf and +inf, so that you are not required to know what's the greatest or smallest element in order to take, for instance, elements "up to a given value".
Also while the interval is for default closed (inclusive) it's possible to specify open intervals prefixing the score with a "(" character, so for instance:
ZRANGEBYSCORE zset (1.3 5
Will return all the values with score > 1.3 and <= 5, while for instance:
ZRANGEBYSCORE zset (5 (10
Will return all the values with score > 5 and < 10 (5 and 10 excluded).
Time complexity:
O(log(N))+O(M) with N being the number of elements in the sorted set and M the number of elements returned by the command, so if M is constant (for instance you always ask for the first ten elements with LIMIT) you can consider it O(log(N))
zrangeByScore
in interface JedisCommands
key
- min
- max
- offset
- count
- zrangeByScore(String, double, double)
,
zrangeByScore(String, double, double, int, int)
,
zrangeByScoreWithScores(String, double, double)
,
zrangeByScoreWithScores(String, double, double, int, int)
,
zcount(String, double, double)
public Set<String> zrangeByScore(String key, String min, String max, int offset, int count)
zrangeByScore
in interface JedisCommands
public Set<Tuple> zrangeByScoreWithScores(String key, double min, double max)
The elements having the same score are returned sorted lexicographically as ASCII strings (this follows from a property of Redis sorted sets and does not involve further computation).
Using the optional LIMIT
it's possible
to get only a range of the matching elements in an SQL-alike way. Note that if offset is large
the commands needs to traverse the list for offset elements and this adds up to the O(M)
figure.
The ZCOUNT
command is similar to
ZRANGEBYSCORE
but instead of returning the
actual elements in the specified interval, it just returns the number of matching elements.
Exclusive intervals and infinity
min and max can be -inf and +inf, so that you are not required to know what's the greatest or smallest element in order to take, for instance, elements "up to a given value".
Also while the interval is for default closed (inclusive) it's possible to specify open intervals prefixing the score with a "(" character, so for instance:
ZRANGEBYSCORE zset (1.3 5
Will return all the values with score > 1.3 and <= 5, while for instance:
ZRANGEBYSCORE zset (5 (10
Will return all the values with score > 5 and < 10 (5 and 10 excluded).
Time complexity:
O(log(N))+O(M) with N being the number of elements in the sorted set and M the number of elements returned by the command, so if M is constant (for instance you always ask for the first ten elements with LIMIT) you can consider it O(log(N))
zrangeByScoreWithScores
in interface JedisCommands
key
- min
- max
- zrangeByScore(String, double, double)
,
zrangeByScore(String, double, double, int, int)
,
zrangeByScoreWithScores(String, double, double)
,
zrangeByScoreWithScores(String, double, double, int, int)
,
zcount(String, double, double)
public Set<Tuple> zrangeByScoreWithScores(String key, String min, String max)
zrangeByScoreWithScores
in interface JedisCommands
public Set<Tuple> zrangeByScoreWithScores(String key, double min, double max, int offset, int count)
The elements having the same score are returned sorted lexicographically as ASCII strings (this follows from a property of Redis sorted sets and does not involve further computation).
Using the optional LIMIT
it's possible
to get only a range of the matching elements in an SQL-alike way. Note that if offset is large
the commands needs to traverse the list for offset elements and this adds up to the O(M)
figure.
The ZCOUNT
command is similar to
ZRANGEBYSCORE
but instead of returning the
actual elements in the specified interval, it just returns the number of matching elements.
Exclusive intervals and infinity
min and max can be -inf and +inf, so that you are not required to know what's the greatest or smallest element in order to take, for instance, elements "up to a given value".
Also while the interval is for default closed (inclusive) it's possible to specify open intervals prefixing the score with a "(" character, so for instance:
ZRANGEBYSCORE zset (1.3 5
Will return all the values with score > 1.3 and <= 5, while for instance:
ZRANGEBYSCORE zset (5 (10
Will return all the values with score > 5 and < 10 (5 and 10 excluded).
Time complexity:
O(log(N))+O(M) with N being the number of elements in the sorted set and M the number of elements returned by the command, so if M is constant (for instance you always ask for the first ten elements with LIMIT) you can consider it O(log(N))
zrangeByScoreWithScores
in interface JedisCommands
key
- min
- max
- offset
- count
- zrangeByScore(String, double, double)
,
zrangeByScore(String, double, double, int, int)
,
zrangeByScoreWithScores(String, double, double)
,
zrangeByScoreWithScores(String, double, double, int, int)
,
zcount(String, double, double)
public Set<Tuple> zrangeByScoreWithScores(String key, String min, String max, int offset, int count)
zrangeByScoreWithScores
in interface JedisCommands
public Set<String> zrevrangeByScore(String key, double max, double min)
zrevrangeByScore
in interface JedisCommands
public Set<String> zrevrangeByScore(String key, String max, String min)
zrevrangeByScore
in interface JedisCommands
public Set<String> zrevrangeByScore(String key, double max, double min, int offset, int count)
zrevrangeByScore
in interface JedisCommands
public Set<Tuple> zrevrangeByScoreWithScores(String key, double max, double min)
zrevrangeByScoreWithScores
in interface JedisCommands
public Set<Tuple> zrevrangeByScoreWithScores(String key, double max, double min, int offset, int count)
zrevrangeByScoreWithScores
in interface JedisCommands
public Set<Tuple> zrevrangeByScoreWithScores(String key, String max, String min, int offset, int count)
zrevrangeByScoreWithScores
in interface JedisCommands
public Set<String> zrevrangeByScore(String key, String max, String min, int offset, int count)
zrevrangeByScore
in interface JedisCommands
public Set<Tuple> zrevrangeByScoreWithScores(String key, String max, String min)
zrevrangeByScoreWithScores
in interface JedisCommands
public Long zremrangeByRank(String key, long start, long stop)
Time complexity: O(log(N))+O(M) with N being the number of elements in the sorted set and M the number of elements removed by the operation
zremrangeByRank
in interface JedisCommands
key
- start
- stop
- public Long zremrangeByScore(String key, double min, double max)
Time complexity:
O(log(N))+O(M) with N being the number of elements in the sorted set and M the number of elements removed by the operation
zremrangeByScore
in interface JedisCommands
key
- min
- max
- public Long zremrangeByScore(String key, String min, String max)
zremrangeByScore
in interface JedisCommands
public Set<String> zunion(ZParams params, String... keys)
zunion
in interface MultiKeyCommands
params
- keys
- public Set<Tuple> zunionWithScores(ZParams params, String... keys)
zunionWithScores
in interface MultiKeyCommands
params
- keys
- public Long zunionstore(String dstkey, String... sets)
As the terms imply, the ZINTERSTORE
command requires an
element to be present in each of the given inputs to be inserted in the result. The
ZUNIONSTORE
command inserts all elements across all
inputs.
Using the WEIGHTS option, it is possible to add weight to each input sorted set. This means that the score of each element in the sorted set is first multiplied by this weight before being passed to the aggregation. When this option is not given, all weights default to 1.
With the AGGREGATE option, it's possible to specify how the results of the union or intersection are aggregated. This option defaults to SUM, where the score of an element is summed across the inputs where it exists. When this option is set to be either MIN or MAX, the resulting set will contain the minimum or maximum score of an element across the inputs where it exists.
Time complexity: O(N) + O(M log(M)) with N being the sum of the sizes of the input sorted sets, and M being the number of elements in the resulting sorted set
zunionstore
in interface MultiKeyCommands
dstkey
- sets
- zunionstore(String, String...)
,
zunionstore(String, ZParams, String...)
,
zinterstore(String, String...)
,
zinterstore(String, ZParams, String...)
public Long zunionstore(String dstkey, ZParams params, String... sets)
As the terms imply, the ZINTERSTORE
command requires an
element to be present in each of the given inputs to be inserted in the result. The
ZUNIONSTORE
command inserts all elements across all
inputs.
Using the WEIGHTS option, it is possible to add weight to each input sorted set. This means that the score of each element in the sorted set is first multiplied by this weight before being passed to the aggregation. When this option is not given, all weights default to 1.
With the AGGREGATE option, it's possible to specify how the results of the union or intersection are aggregated. This option defaults to SUM, where the score of an element is summed across the inputs where it exists. When this option is set to be either MIN or MAX, the resulting set will contain the minimum or maximum score of an element across the inputs where it exists.
Time complexity: O(N) + O(M log(M)) with N being the sum of the sizes of the input sorted sets, and M being the number of elements in the resulting sorted set
zunionstore
in interface MultiKeyCommands
dstkey
- sets
- params
- zunionstore(String, String...)
,
zunionstore(String, ZParams, String...)
,
zinterstore(String, String...)
,
zinterstore(String, ZParams, String...)
public Set<String> zinter(ZParams params, String... keys)
zinter
in interface MultiKeyCommands
params
- keys
- public Set<Tuple> zinterWithScores(ZParams params, String... keys)
zinterWithScores
in interface MultiKeyCommands
params
- keys
- public Long zinterstore(String dstkey, String... sets)
As the terms imply, the ZINTERSTORE
command requires an
element to be present in each of the given inputs to be inserted in the result. The
ZUNIONSTORE
command inserts all elements across all
inputs.
Using the WEIGHTS option, it is possible to add weight to each input sorted set. This means that the score of each element in the sorted set is first multiplied by this weight before being passed to the aggregation. When this option is not given, all weights default to 1.
With the AGGREGATE option, it's possible to specify how the results of the union or intersection are aggregated. This option defaults to SUM, where the score of an element is summed across the inputs where it exists. When this option is set to be either MIN or MAX, the resulting set will contain the minimum or maximum score of an element across the inputs where it exists.
Time complexity: O(N) + O(M log(M)) with N being the sum of the sizes of the input sorted sets, and M being the number of elements in the resulting sorted set
zinterstore
in interface MultiKeyCommands
dstkey
- sets
- zunionstore(String, String...)
,
zunionstore(String, ZParams, String...)
,
zinterstore(String, String...)
,
zinterstore(String, ZParams, String...)
public Long zinterstore(String dstkey, ZParams params, String... sets)
As the terms imply, the ZINTERSTORE
command requires an
element to be present in each of the given inputs to be inserted in the result. The
ZUNIONSTORE
command inserts all elements across all
inputs.
Using the WEIGHTS option, it is possible to add weight to each input sorted set. This means that the score of each element in the sorted set is first multiplied by this weight before being passed to the aggregation. When this option is not given, all weights default to 1.
With the AGGREGATE option, it's possible to specify how the results of the union or intersection are aggregated. This option defaults to SUM, where the score of an element is summed across the inputs where it exists. When this option is set to be either MIN or MAX, the resulting set will contain the minimum or maximum score of an element across the inputs where it exists.
Time complexity: O(N) + O(M log(M)) with N being the sum of the sizes of the input sorted sets, and M being the number of elements in the resulting sorted set
zinterstore
in interface MultiKeyCommands
dstkey
- sets
- params
- zunionstore(String, String...)
,
zunionstore(String, ZParams, String...)
,
zinterstore(String, String...)
,
zinterstore(String, ZParams, String...)
public Long zlexcount(String key, String min, String max)
zlexcount
in interface JedisCommands
public Set<String> zrangeByLex(String key, String min, String max)
zrangeByLex
in interface JedisCommands
public Set<String> zrangeByLex(String key, String min, String max, int offset, int count)
zrangeByLex
in interface JedisCommands
public Set<String> zrevrangeByLex(String key, String max, String min)
zrevrangeByLex
in interface JedisCommands
public Set<String> zrevrangeByLex(String key, String max, String min, int offset, int count)
zrevrangeByLex
in interface JedisCommands
public Long zremrangeByLex(String key, String min, String max)
zremrangeByLex
in interface JedisCommands
public Long strlen(String key)
strlen
in interface JedisCommands
public LCSMatchResult strAlgoLCSKeys(String keyA, String keyB, StrAlgoLCSParams params)
strAlgoLCSKeys
in interface MultiKeyCommands
keyA
- keyAkeyB
- keyBparams
- the paramspublic LCSMatchResult strAlgoLCSStrings(String strA, String strB, StrAlgoLCSParams params)
strAlgoLCSStrings
in interface JedisCommands
strA
- strAstrB
- strBparams
- the paramspublic Long lpushx(String key, String... string)
lpushx
in interface JedisCommands
public Long persist(String key)
expire
at turning the expire key into a normal key.
Time complexity: O(1)
persist
in interface JedisCommands
key
- public Long rpushx(String key, String... string)
rpushx
in interface JedisCommands
public String echo(String string)
echo
in interface JedisCommands
public Long linsert(String key, ListPosition where, String pivot, String value)
linsert
in interface JedisCommands
public String brpoplpush(String source, String destination, int timeout)
brpoplpush
in interface MultiKeyCommands
source
- destination
- timeout
- public Boolean setbit(String key, long offset, boolean value)
setbit
in interface JedisCommands
key
- offset
- value
- @Deprecated public Boolean setbit(String key, long offset, String value)
setbit
in interface JedisCommands
public Boolean getbit(String key, long offset)
getbit
in interface JedisCommands
key
- offset
- public Long setrange(String key, long offset, String value)
setrange
in interface JedisCommands
public String getrange(String key, long startOffset, long endOffset)
getrange
in interface JedisCommands
public Long bitpos(String key, boolean value)
bitpos
in interface JedisCommands
public Long bitpos(String key, boolean value, BitPosParams params)
bitpos
in interface JedisCommands
public List<Object> role()
role
in interface AdvancedJedisCommands
public List<String> configGet(String pattern)
CONFIG GET returns the current configuration parameters. This sub command only accepts a single argument, that is glob style pattern. All the configuration parameters matching this parameter are reported as a list of key-value pairs.
Example:
$ redis-cli config get '*' 1. "dbfilename" 2. "dump.rdb" 3. "requirepass" 4. (nil) 5. "masterauth" 6. (nil) 7. "maxmemory" 8. "0\n" 9. "appendfsync" 10. "everysec" 11. "save" 12. "3600 1 300 100 60 10000" $ redis-cli config get 'm*' 1. "masterauth" 2. (nil) 3. "maxmemory" 4. "0\n"
configGet
in interface AdvancedJedisCommands
pattern
- public String configSet(String parameter, String value)
The list of configuration parameters supported by CONFIG SET can be obtained issuing a
CONFIG GET *
command.
The configuration set using CONFIG SET is immediately loaded by the Redis server that will start acting as specified starting from the next command.
Parameters value format
The value of the configuration parameter is the same as the one of the same parameter in the Redis configuration file, with the following exceptions:
configSet
in interface AdvancedJedisCommands
parameter
- value
- public void subscribe(JedisPubSub jedisPubSub, String... channels)
subscribe
in interface MultiKeyCommands
public Long publish(String channel, String message)
publish
in interface MultiKeyCommands
public void psubscribe(JedisPubSub jedisPubSub, String... patterns)
psubscribe
in interface MultiKeyCommands
public Object eval(String script, int keyCount, String... params)
eval
in interface ScriptingCommands
public Object eval(String script, List<String> keys, List<String> args)
eval
in interface ScriptingCommands
public Object eval(String script)
eval
in interface ScriptingCommands
public Object evalsha(String sha1)
evalsha
in interface ScriptingCommands
public Object evalsha(String sha1, List<String> keys, List<String> args)
evalsha
in interface ScriptingCommands
public Object evalsha(String sha1, int keyCount, String... params)
evalsha
in interface ScriptingCommands
public Boolean scriptExists(String sha1)
scriptExists
in interface ScriptingCommands
public List<Boolean> scriptExists(String... sha1)
scriptExists
in interface ScriptingCommands
public String scriptLoad(String script)
scriptLoad
in interface ScriptingCommands
public List<Slowlog> slowlogGet()
slowlogGet
in interface AdvancedJedisCommands
public List<Slowlog> slowlogGet(long entries)
slowlogGet
in interface AdvancedJedisCommands
public Long objectRefcount(String key)
objectRefcount
in interface AdvancedJedisCommands
public String objectEncoding(String key)
objectEncoding
in interface AdvancedJedisCommands
public Long objectIdletime(String key)
objectIdletime
in interface AdvancedJedisCommands
public List<String> objectHelp()
objectHelp
in interface AdvancedJedisCommands
public Long objectFreq(String key)
objectFreq
in interface AdvancedJedisCommands
public Long bitcount(String key)
bitcount
in interface JedisCommands
public Long bitcount(String key, long start, long end)
bitcount
in interface JedisCommands
public Long bitop(BitOP op, String destKey, String... srcKeys)
bitop
in interface MultiKeyCommands
public String sentinelMyId()
sentinelMyId
in interface SentinelCommands
public List<Map<String,String>> sentinelMasters()
redis 127.0.0.1:26381> sentinel masters 1) 1) "name" 2) "mymaster" 3) "ip" 4) "127.0.0.1" 5) "port" 6) "6379" 7) "runid" 8) "93d4d4e6e9c06d0eea36e27f31924ac26576081d" 9) "flags" 10) "master" 11) "pending-commands" 12) "0" 13) "last-ok-ping-reply" 14) "423" 15) "last-ping-reply" 16) "423" 17) "info-refresh" 18) "6107" 19) "num-slaves" 20) "1" 21) "num-other-sentinels" 22) "2" 23) "quorum" 24) "2"
sentinelMasters
in interface SentinelCommands
public Map<String,String> sentinelMaster(String masterName)
sentinelMaster
in interface SentinelCommands
public List<Map<String,String>> sentinelSentinels(String masterName)
sentinelSentinels
in interface SentinelCommands
public List<String> sentinelGetMasterAddrByName(String masterName)
redis 127.0.0.1:26381> sentinel get-master-addr-by-name mymaster 1) "127.0.0.1" 2) "6379"
sentinelGetMasterAddrByName
in interface SentinelCommands
masterName
- public Long sentinelReset(String pattern)
redis 127.0.0.1:26381> sentinel reset mymaster (integer) 1
sentinelReset
in interface SentinelCommands
pattern
- @Deprecated public List<Map<String,String>> sentinelSlaves(String masterName)
sentinelReplicas(java.lang.String)
.sentinelSlaves
in interface SentinelCommands
public List<Map<String,String>> sentinelReplicas(String masterName)
redis 127.0.0.1:26381> sentinel replicas mymaster 1) 1) "name" 2) "127.0.0.1:6380" 3) "ip" 4) "127.0.0.1" 5) "port" 6) "6380" 7) "runid" 8) "d7f6c0ca7572df9d2f33713df0dbf8c72da7c039" 9) "flags" 10) "slave" 11) "pending-commands" 12) "0" 13) "last-ok-ping-reply" 14) "47" 15) "last-ping-reply" 16) "47" 17) "info-refresh" 18) "657" 19) "master-link-down-time" 20) "0" 21) "master-link-status" 22) "ok" 23) "master-host" 24) "localhost" 25) "master-port" 26) "6379" 27) "slave-priority" 28) "100"
sentinelReplicas
in interface SentinelCommands
masterName
- public String sentinelFailover(String masterName)
sentinelFailover
in interface SentinelCommands
public String sentinelMonitor(String masterName, String ip, int port, int quorum)
sentinelMonitor
in interface SentinelCommands
public String sentinelRemove(String masterName)
sentinelRemove
in interface SentinelCommands
public String sentinelSet(String masterName, Map<String,String> parameterMap)
sentinelSet
in interface SentinelCommands
public byte[] dump(String key)
dump
in interface JedisCommands
public String restore(String key, long ttl, byte[] serializedValue)
restore
in interface JedisCommands
public String restoreReplace(String key, long ttl, byte[] serializedValue)
restoreReplace
in interface JedisCommands
public String restore(String key, long ttl, byte[] serializedValue, RestoreParams params)
restore
in interface JedisCommands
public Long pexpire(String key, long milliseconds)
pexpire
in interface JedisCommands
public Long pexpireAt(String key, long millisecondsTimestamp)
pexpireAt
in interface JedisCommands
public Long pttl(String key)
pttl
in interface JedisCommands
public String psetex(String key, long milliseconds, String value)
JedisCommands.setex(String, int, String)
with the sole difference that the
expire time is specified in milliseconds instead of seconds. Time complexity: O(1)psetex
in interface JedisCommands
key
- milliseconds
- value
- public String clientKill(String ipPort)
clientKill
in interface AdvancedJedisCommands
public String clientGetname()
clientGetname
in interface AdvancedJedisCommands
public String clientList()
clientList
in interface AdvancedJedisCommands
public String clientList(ClientType type)
clientList
in interface AdvancedJedisCommands
public String clientList(long... clientIds)
clientList
in interface AdvancedJedisCommands
public String clientInfo()
clientInfo
in interface AdvancedJedisCommands
public String clientSetname(String name)
clientSetname
in interface AdvancedJedisCommands
public Long clientId()
clientId
in interface AdvancedBinaryJedisCommands
clientId
in interface AdvancedJedisCommands
clientId
in class BinaryJedis
public Long clientUnblock(long clientId, UnblockType unblockType)
clientUnblock
in interface AdvancedBinaryJedisCommands
clientUnblock
in interface AdvancedJedisCommands
clientUnblock
in class BinaryJedis
clientId
- unblockType
- could be null
by default the client is unblocked as if the timeout
of the command was reachedpublic String migrate(String host, int port, String key, int destinationDb, int timeout)
migrate
in interface AdvancedJedisCommands
public String migrate(String host, int port, int destinationDB, int timeout, MigrateParams params, String... keys)
migrate
in interface AdvancedJedisCommands
public ScanResult<String> scan(String cursor)
scan
in interface MultiKeyCommands
MultiKeyCommands.scan(String, ScanParams)
public ScanResult<String> scan(String cursor, ScanParams params)
MultiKeyCommands
Since this command allows for incremental iteration, returning only a small number of elements
per call, it can be used in production without the downside of commands like
MultiKeyCommands.keys(String)
or JedisCommands.smembers(String)
)} that may block the server
for a long time (even several seconds) when called against big collections of keys or elements.
SCAN basic usage
SCAN is a cursor based iterator. This means that at every call of the command, the server
returns an updated cursor that the user needs to use as the cursor argument in the next call.
An iteration starts when the cursor is set to 0, and terminates when the cursor returned by the
server is 0.
Scan guarantees
The SCAN command, and the other commands in the SCAN family, are able to provide to the user a
set of guarantees associated to full iterations.
Time complexity: O(1) for every call. O(N) for a complete iteration, including enough command calls for the cursor to return back to 0. N is the number of elements inside the DB.
scan
in interface MultiKeyCommands
cursor
- The cursor.params
- the scan parameters. For example a glob-style match patternpublic ScanResult<String> scan(String cursor, ScanParams params, String type)
scan
in interface MultiKeyCommands
public ScanResult<Map.Entry<String,String>> hscan(String key, String cursor)
hscan
in interface JedisCommands
public ScanResult<Map.Entry<String,String>> hscan(String key, String cursor, ScanParams params)
hscan
in interface JedisCommands
public ScanResult<String> sscan(String key, String cursor)
sscan
in interface JedisCommands
public ScanResult<String> sscan(String key, String cursor, ScanParams params)
sscan
in interface JedisCommands
public ScanResult<Tuple> zscan(String key, String cursor)
zscan
in interface JedisCommands
public ScanResult<Tuple> zscan(String key, String cursor, ScanParams params)
zscan
in interface JedisCommands
public String readonly()
readonly
in interface ClusterCommands
public String readwrite()
readwrite
in interface ClusterCommands
public String clusterNodes()
clusterNodes
in interface ClusterCommands
public String clusterReplicas(String nodeId)
clusterReplicas
in interface ClusterCommands
public String clusterMeet(String ip, int port)
clusterMeet
in interface ClusterCommands
public String clusterReset(ClusterReset resetType)
clusterReset
in interface ClusterCommands
public String clusterReset(ClusterResetType resetType)
ClusterCommands
resetType
can be null for default behavior.clusterReset
in interface ClusterCommands
public String clusterAddSlots(int... slots)
clusterAddSlots
in interface ClusterCommands
public String clusterDelSlots(int... slots)
clusterDelSlots
in interface ClusterCommands
public String clusterInfo()
clusterInfo
in interface ClusterCommands
public List<String> clusterGetKeysInSlot(int slot, int count)
clusterGetKeysInSlot
in interface ClusterCommands
public List<byte[]> clusterGetKeysInSlotBinary(int slot, int count)
clusterGetKeysInSlotBinary
in interface ClusterCommands
public String clusterSetSlotNode(int slot, String nodeId)
clusterSetSlotNode
in interface ClusterCommands
public String clusterSetSlotMigrating(int slot, String nodeId)
clusterSetSlotMigrating
in interface ClusterCommands
public String clusterSetSlotImporting(int slot, String nodeId)
clusterSetSlotImporting
in interface ClusterCommands
public String clusterSetSlotStable(int slot)
clusterSetSlotStable
in interface ClusterCommands
public String clusterForget(String nodeId)
clusterForget
in interface ClusterCommands
public String clusterFlushSlots()
clusterFlushSlots
in interface ClusterCommands
public Long clusterKeySlot(String key)
clusterKeySlot
in interface ClusterCommands
public Long clusterCountKeysInSlot(int slot)
clusterCountKeysInSlot
in interface ClusterCommands
public String clusterSaveConfig()
clusterSaveConfig
in interface ClusterCommands
public String clusterReplicate(String nodeId)
clusterReplicate
in interface ClusterCommands
public List<String> clusterSlaves(String nodeId)
ClusterCommands
CLUSTER SLAVES
command is deprecated since Redis 5.clusterSlaves
in interface ClusterCommands
public String clusterFailover(ClusterFailoverOption failoverOption)
clusterFailover
in interface ClusterCommands
public List<Object> clusterSlots()
clusterSlots
in interface ClusterCommands
public String clusterMyId()
clusterMyId
in interface ClusterCommands
public String asking()
public Long pubsubNumPat()
public Map<String,String> pubsubNumSub(String... channels)
java.util.Map<java.lang.String, java.lang.Long>
in next major release.public void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in class BinaryJedis
public void setDataSource(JedisPoolAbstract jedisPool)
protected
in next major release.jedisPool
- public Long pfadd(String key, String... elements)
pfadd
in interface JedisCommands
public long pfcount(String key)
pfcount
in interface JedisCommands
public long pfcount(String... keys)
pfcount
in interface MultiKeyCommands
public String pfmerge(String destkey, String... sourcekeys)
pfmerge
in interface MultiKeyCommands
public Long geoadd(String key, double longitude, double latitude, String member)
geoadd
in interface JedisCommands
public Long geoadd(String key, Map<String,GeoCoordinate> memberCoordinateMap)
geoadd
in interface JedisCommands
public Long geoadd(String key, GeoAddParams params, Map<String,GeoCoordinate> memberCoordinateMap)
geoadd
in interface JedisCommands
public Double geodist(String key, String member1, String member2)
geodist
in interface JedisCommands
public Double geodist(String key, String member1, String member2, GeoUnit unit)
geodist
in interface JedisCommands
public List<String> geohash(String key, String... members)
geohash
in interface JedisCommands
public List<GeoCoordinate> geopos(String key, String... members)
geopos
in interface JedisCommands
public List<GeoRadiusResponse> georadius(String key, double longitude, double latitude, double radius, GeoUnit unit)
georadius
in interface JedisCommands
public List<GeoRadiusResponse> georadiusReadonly(String key, double longitude, double latitude, double radius, GeoUnit unit)
georadiusReadonly
in interface JedisCommands
public List<GeoRadiusResponse> georadius(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param)
georadius
in interface JedisCommands
public Long georadiusStore(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam)
georadiusStore
in interface MultiKeyCommands
public List<GeoRadiusResponse> georadiusReadonly(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param)
georadiusReadonly
in interface JedisCommands
public List<GeoRadiusResponse> georadiusByMember(String key, String member, double radius, GeoUnit unit)
georadiusByMember
in interface JedisCommands
public List<GeoRadiusResponse> georadiusByMemberReadonly(String key, String member, double radius, GeoUnit unit)
georadiusByMemberReadonly
in interface JedisCommands
public List<GeoRadiusResponse> georadiusByMember(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param)
georadiusByMember
in interface JedisCommands
public Long georadiusByMemberStore(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam)
georadiusByMemberStore
in interface MultiKeyCommands
public List<GeoRadiusResponse> georadiusByMemberReadonly(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param)
georadiusByMemberReadonly
in interface JedisCommands
public String moduleLoad(String path)
moduleLoad
in interface ModuleCommands
public String moduleUnload(String name)
moduleUnload
in interface ModuleCommands
public List<Module> moduleList()
moduleList
in interface ModuleCommands
public String aclSetUser(String name)
aclSetUser
in interface AdvancedJedisCommands
public String aclSetUser(String name, String... params)
aclSetUser
in interface AdvancedJedisCommands
public Long aclDelUser(String name)
aclDelUser
in interface AdvancedJedisCommands
public AccessControlUser aclGetUser(String name)
aclGetUser
in interface AdvancedJedisCommands
public List<String> aclUsers()
aclUsers
in interface AdvancedJedisCommands
public List<String> aclList()
aclList
in interface AdvancedJedisCommands
public String aclWhoAmI()
aclWhoAmI
in interface AdvancedJedisCommands
public List<String> aclCat()
aclCat
in interface AdvancedJedisCommands
public List<String> aclCat(String category)
aclCat
in interface AdvancedJedisCommands
public List<AccessControlLogEntry> aclLog()
aclLog
in interface AdvancedJedisCommands
public List<AccessControlLogEntry> aclLog(int limit)
aclLog
in interface AdvancedJedisCommands
@Deprecated public String aclLog(String options)
BinaryJedis.aclLogReset()
.aclLog
in interface AdvancedJedisCommands
public String aclGenPass()
aclGenPass
in interface AdvancedJedisCommands
public String aclLoad()
aclLoad
in interface AdvancedBinaryJedisCommands
aclLoad
in interface AdvancedJedisCommands
aclLoad
in class BinaryJedis
public String aclSave()
aclSave
in interface AdvancedBinaryJedisCommands
aclSave
in interface AdvancedJedisCommands
aclSave
in class BinaryJedis
public List<Long> bitfield(String key, String... arguments)
JedisCommands
bitfield
in interface JedisCommands
public List<Long> bitfieldReadonly(String key, String... arguments)
bitfieldReadonly
in interface JedisCommands
public Long hstrlen(String key, String field)
JedisCommands
hstrlen
in interface JedisCommands
public String memoryDoctor()
memoryDoctor
in interface AdvancedJedisCommands
public Long memoryUsage(String key)
memoryUsage
in interface AdvancedJedisCommands
public Long memoryUsage(String key, int samples)
memoryUsage
in interface AdvancedJedisCommands
public StreamEntryID xadd(String key, StreamEntryID id, Map<String,String> hash)
JedisCommands
xadd
in interface JedisCommands
public StreamEntryID xadd(String key, StreamEntryID id, Map<String,String> hash, long maxLen, boolean approximateLength)
JedisCommands
xadd
in interface JedisCommands
public StreamEntryID xadd(String key, Map<String,String> hash, XAddParams params)
JedisCommands
xadd
in interface JedisCommands
public Long xlen(String key)
JedisCommands
xlen
in interface JedisCommands
public List<StreamEntry> xrange(String key, StreamEntryID start, StreamEntryID end)
JedisCommands
StreamEntryID
would resolve the error.xrange
in interface JedisCommands
start
- minimum StreamEntryID
for the retrieved range, passing null
will indicate minimum ID possible in the streamend
- maximum StreamEntryID
for the retrieved range, passing null
will indicate maximum ID possible in the streampublic List<StreamEntry> xrange(String key, StreamEntryID start, StreamEntryID end, int count)
StreamEntryID
would resolve the error.xrange
in interface JedisCommands
start
- minimum StreamEntryID
for the retrieved range, passing null
will indicate minimum ID possible in the streamend
- maximum StreamEntryID
for the retrieved range, passing null
will indicate maximum ID possible in the streamcount
- maximum number of entries returnedpublic List<StreamEntry> xrevrange(String key, StreamEntryID end, StreamEntryID start)
JedisCommands
StreamEntryID
would resolve the error.xrevrange
in interface JedisCommands
end
- maximum StreamEntryID
for the retrieved range, passing null
will indicate maximum ID possible in the streamstart
- minimum StreamEntryID
for the retrieved range, passing null
will indicate minimum ID possible in the streampublic List<StreamEntry> xrevrange(String key, StreamEntryID end, StreamEntryID start, int count)
StreamEntryID
would resolve the error.xrevrange
in interface JedisCommands
end
- maximum StreamEntryID
for the retrieved range, passing null
will indicate maximum ID possible in the streamstart
- minimum StreamEntryID
for the retrieved range, passing null
will indicate minimum ID possible in the streamcount
- The entries with IDs matching the specified range.public List<Map.Entry<String,List<StreamEntry>>> xread(int count, long block, Map.Entry<String,StreamEntryID>... streams)
xread
in interface MultiKeyCommands
public List<Map.Entry<String,List<StreamEntry>>> xread(XReadParams xReadParams, Map<String,StreamEntryID> streams)
xread
in interface MultiKeyCommands
public long xack(String key, String group, StreamEntryID... ids)
xack
in interface JedisCommands
public String xgroupCreate(String key, String groupname, StreamEntryID id, boolean makeStream)
JedisCommands
xgroupCreate
in interface JedisCommands
public String xgroupSetID(String key, String groupname, StreamEntryID id)
JedisCommands
xgroupSetID
in interface JedisCommands
public long xgroupDestroy(String key, String groupname)
JedisCommands
xgroupDestroy
in interface JedisCommands
public Long xgroupDelConsumer(String key, String groupname, String consumerName)
JedisCommands
xgroupDelConsumer
in interface JedisCommands
public long xdel(String key, StreamEntryID... ids)
JedisCommands
xdel
in interface JedisCommands
public long xtrim(String key, long maxLen, boolean approximateLength)
JedisCommands
xtrim
in interface JedisCommands
public long xtrim(String key, XTrimParams params)
JedisCommands
xtrim
in interface JedisCommands
public List<Map.Entry<String,List<StreamEntry>>> xreadGroup(String groupname, String consumer, int count, long block, boolean noAck, Map.Entry<String,StreamEntryID>... streams)
xreadGroup
in interface MultiKeyCommands
public List<Map.Entry<String,List<StreamEntry>>> xreadGroup(String groupname, String consumer, XReadGroupParams xReadGroupParams, Map<String,StreamEntryID> streams)
xreadGroup
in interface MultiKeyCommands
public StreamPendingSummary xpending(String key, String groupname)
JedisCommands
xpending
in interface JedisCommands
public List<StreamPendingEntry> xpending(String key, String groupname, StreamEntryID start, StreamEntryID end, int count, String consumername)
JedisCommands
xpending
in interface JedisCommands
public List<StreamPendingEntry> xpending(String key, String groupname, XPendingParams params)
JedisCommands
xpending
in interface JedisCommands
public List<StreamEntry> xclaim(String key, String group, String consumername, long minIdleTime, long newIdleTime, int retries, boolean force, StreamEntryID... ids)
JedisCommands
xclaim
in interface JedisCommands
public List<StreamEntry> xclaim(String key, String group, String consumername, long minIdleTime, XClaimParams params, StreamEntryID... ids)
JedisCommands
xclaim
in interface JedisCommands
public List<StreamEntryID> xclaimJustId(String key, String group, String consumername, long minIdleTime, XClaimParams params, StreamEntryID... ids)
JedisCommands
xclaimJustId
in interface JedisCommands
public Map.Entry<StreamEntryID,List<StreamEntry>> xautoclaim(String key, String group, String consumerName, long minIdleTime, StreamEntryID start, XAutoClaimParams params)
JedisCommands
xautoclaim
in interface JedisCommands
key
- Stream Keygroup
- Consumer GroupconsumerName
- Consumer name to transfer the auto claimed entriesminIdleTime
- Entries pending more than minIdleTime will be transferred ownershipstart
- StreamEntryID
- Entries >= start will be transferred ownership, passing null
will indicate '-'params
- XAutoClaimParams
public Map.Entry<StreamEntryID,List<StreamEntryID>> xautoclaimJustId(String key, String group, String consumerName, long minIdleTime, StreamEntryID start, XAutoClaimParams params)
JedisCommands
xautoclaimJustId
in interface JedisCommands
key
- Stream Keygroup
- Consumer GroupconsumerName
- Consumer name to transfer the auto claimed entriesminIdleTime
- Entries pending more than minIdleTime will be transferred ownershipstart
- StreamEntryID
- Entries >= start will be transferred ownership, passing null
will indicate '-'params
- XAutoClaimParams
public StreamInfo xinfoStream(String key)
JedisCommands
xinfoStream
in interface JedisCommands
key
- Stream nameStreamInfo
that contains information about the streampublic List<StreamGroupInfo> xinfoGroup(String key)
JedisCommands
xinfoGroup
in interface JedisCommands
key
- Stream nameStreamGroupInfo
containing information about groupspublic List<StreamConsumersInfo> xinfoConsumers(String key, String group)
JedisCommands
xinfoConsumers
in interface JedisCommands
key
- Stream namegroup
- Group nameStreamConsumersInfo
containing information about consumers that belong
to the the grouppublic Object sendCommand(ProtocolCommand cmd, String... args)
public Object sendBlockingCommand(ProtocolCommand cmd, String... args)
Copyright © 2021. All rights reserved.