public interface MultiKeyCommands
Modifier and Type | Method and Description |
---|---|
Long |
bitop(BitOP op,
String destKey,
String... srcKeys) |
List<String> |
blpop(int timeout,
String... keys) |
List<String> |
blpop(String... args) |
List<String> |
brpop(int timeout,
String... keys) |
List<String> |
brpop(String... args) |
String |
brpoplpush(String source,
String destination,
int timeout) |
Long |
del(String... keys) |
Long |
exists(String... keys) |
Long |
georadiusByMemberStore(String key,
String member,
double radius,
GeoUnit unit,
GeoRadiusParam param,
GeoRadiusStoreParam storeParam) |
Long |
georadiusStore(String key,
double longitude,
double latitude,
double radius,
GeoUnit unit,
GeoRadiusParam param,
GeoRadiusStoreParam storeParam) |
Set<String> |
keys(String pattern)
Returns all the keys matching the glob-style pattern.
|
List<String> |
mget(String... keys) |
String |
mset(String... keysvalues) |
Long |
msetnx(String... keysvalues) |
long |
pfcount(String... keys) |
String |
pfmerge(String destkey,
String... sourcekeys) |
void |
psubscribe(JedisPubSub jedisPubSub,
String... patterns) |
Long |
publish(String channel,
String message) |
String |
randomKey() |
String |
rename(String oldkey,
String newkey) |
Long |
renamenx(String oldkey,
String newkey) |
String |
rpoplpush(String srckey,
String dstkey) |
ScanResult<String> |
scan(String cursor) |
ScanResult<String> |
scan(String cursor,
ScanParams params)
Iterates the set of keys in the currently selected Redis database.
|
Set<String> |
sdiff(String... keys) |
Long |
sdiffstore(String dstkey,
String... keys) |
Set<String> |
sinter(String... keys) |
Long |
sinterstore(String dstkey,
String... keys) |
Long |
smove(String srckey,
String dstkey,
String member) |
Long |
sort(String key,
SortingParams sortingParameters,
String dstkey) |
Long |
sort(String key,
String dstkey) |
void |
subscribe(JedisPubSub jedisPubSub,
String... channels) |
Set<String> |
sunion(String... keys) |
Long |
sunionstore(String dstkey,
String... keys) |
Long |
touch(String... keys) |
Long |
unlink(String... keys) |
String |
unwatch() |
String |
watch(String... keys) |
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>>> |
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 ...]
|
Long |
zinterstore(String dstkey,
String... sets) |
Long |
zinterstore(String dstkey,
ZParams params,
String... sets) |
Long |
zunionstore(String dstkey,
String... sets) |
Long |
zunionstore(String dstkey,
ZParams params,
String... sets) |
Set<String> keys(String pattern)
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)
pattern
- Long sort(String key, SortingParams sortingParameters, String dstkey)
String unwatch()
void subscribe(JedisPubSub jedisPubSub, String... channels)
void psubscribe(JedisPubSub jedisPubSub, String... patterns)
String randomKey()
ScanResult<String> scan(String cursor)
cursor
- scan(String, ScanParams)
ScanResult<String> scan(String cursor, ScanParams params)
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 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.
cursor
- The cursor.params
- the scan parameters. For example a glob-style match patternlong pfcount(String... keys)
List<Map.Entry<String,List<StreamEntry>>> xread(int count, long block, Map.Entry<String,StreamEntryID>... streams)
count
- block
- streams
- List<Map.Entry<String,List<StreamEntry>>> xreadGroup(String groupname, String consumer, int count, long block, boolean noAck, Map.Entry<String,StreamEntryID>... streams)
groupname
- consumer
- count
- block
- streams
- Long georadiusStore(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam)
Long georadiusByMemberStore(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam)
Copyright © 2021. All rights reserved.