public interface RKeys extends RKeysAsync
Modifier and Type | Method and Description |
---|---|
boolean |
clearExpire(String name)
Clear an expire timeout or expire date for object.
|
void |
copy(String name,
String host,
int port,
int database,
long timeout)
Copy object from source Redis instance to destination Redis instance
|
long |
count()
Returns the number of keys in the currently-selected database
|
long |
countExists(String... names)
Checks if provided keys exist
|
long |
delete(RObject... objects)
Delete multiple objects
|
long |
delete(String... keys)
Delete multiple objects by name
|
long |
deleteByPattern(String pattern)
Delete multiple objects by a key pattern.
|
boolean |
expire(String name,
long timeToLive,
TimeUnit timeUnit)
Set a timeout for object.
|
boolean |
expireAt(String name,
long timestamp)
Set an expire date for object.
|
Collection<String> |
findKeysByPattern(String pattern)
Deprecated.
|
void |
flushall()
Delete all keys of all existing databases
|
void |
flushallParallel()
Delete all keys of all existing databases
in background without blocking server.
|
void |
flushdb()
Delete all keys of currently selected database
|
void |
flushdbParallel()
Delete all keys of currently selected database
in background without blocking server.
|
Iterable<String> |
getKeys()
Get all keys using iterator.
|
Iterable<String> |
getKeys(int count)
Get all keys using iterator.
|
Iterable<String> |
getKeysByPattern(String pattern)
Get all keys by pattern using iterator.
|
Iterable<String> |
getKeysByPattern(String pattern,
int count)
Get all keys by pattern using iterator.
|
Stream<String> |
getKeysStream()
Get all keys using Stream.
|
Stream<String> |
getKeysStream(int count)
Get all keys using Stream.
|
Stream<String> |
getKeysStreamByPattern(String pattern)
Get all keys by pattern using Stream.
|
Stream<String> |
getKeysStreamByPattern(String pattern,
int count)
Get all keys by pattern using Stream.
|
int |
getSlot(String key)
Get hash slot identifier for key.
|
RType |
getType(String key)
Get Redis object type by key
|
void |
migrate(String name,
String host,
int port,
int database,
long timeout)
Transfer object from source Redis instance to destination Redis instance
|
boolean |
move(String name,
int database)
Move object to another database
|
String |
randomKey()
Get random key
|
long |
remainTimeToLive(String name)
Remaining time to live of Redisson object that has a timeout
|
void |
rename(String currentName,
String newName)
Rename current object key to
newName |
boolean |
renamenx(String oldName,
String newName)
Rename object with
oldName to newName
only if new key is not exists |
long |
touch(String... names)
Update the last access time of an object.
|
long |
unlink(String... keys)
Delete multiple objects by name.
|
clearExpireAsync, copyAsync, countAsync, countExistsAsync, deleteAsync, deleteAsync, deleteByPatternAsync, expireAsync, expireAtAsync, findKeysByPatternAsync, flushallAsync, flushallParallelAsync, flushdbAsync, flushdbParallelAsync, getSlotAsync, getTypeAsync, migrateAsync, moveAsync, randomKeyAsync, remainTimeToLiveAsync, renameAsync, renamenxAsync, touchAsync, unlinkAsync
boolean move(String name, int database)
name
- of objectdatabase
- - Redis database numbertrue
if key was moved else false
void migrate(String name, String host, int port, int database, long timeout)
name
- of objecthost
- - destination hostport
- - destination portdatabase
- - destination databasetimeout
- - maximum idle time in any moment of the communication with the destination instance in millisecondsvoid copy(String name, String host, int port, int database, long timeout)
name
- of objecthost
- - destination hostport
- - destination portdatabase
- - destination databasetimeout
- - maximum idle time in any moment of the communication with the destination instance in millisecondsboolean expire(String name, long timeToLive, TimeUnit timeUnit)
name
- of objecttimeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unittrue
if the timeout was set and false
if notboolean expireAt(String name, long timestamp)
name
- of objecttimestamp
- - expire date in milliseconds (Unix timestamp)true
if the timeout was set and false
if notboolean clearExpire(String name)
name
- of objecttrue
if timeout was removed
false
if object does not exist or does not have an associated timeoutboolean renamenx(String oldName, String newName)
oldName
to newName
only if new key is not existsoldName
- - old name of objectnewName
- - new name of objecttrue
if object has been renamed successfully and false
otherwisevoid rename(String currentName, String newName)
newName
currentName
- - current name of objectnewName
- - new name of objectlong remainTimeToLive(String name)
name
- of keylong touch(String... names)
names
- of keyslong countExists(String... names)
names
- of keysRType getType(String key)
key
- - name of keyint getSlot(String key)
key
- - name of keyIterable<String> getKeysByPattern(String pattern)
Supported glob-style patterns:
h?llo subscribes to hello, hallo and hxllo
h*llo subscribes to hllo and heeeello
h[ae]llo subscribes to hello and hallo, but not hillo
pattern
- - match patternIterable<String> getKeysByPattern(String pattern, int count)
count
keys per request.
Supported glob-style patterns:
h?llo subscribes to hello, hallo and hxllo
h*llo subscribes to hllo and heeeello
h[ae]llo subscribes to hello and hallo, but not hillo
pattern
- - match patterncount
- - keys loaded per request to RedisIterable<String> getKeys()
10
keys per request.Iterable<String> getKeys(int count)
count
keys per request.count
- - keys loaded per request to RedisStream<String> getKeysStreamByPattern(String pattern)
Supported glob-style patterns:
h?llo subscribes to hello, hallo and hxllo
h*llo subscribes to hllo and heeeello
h[ae]llo subscribes to hello and hallo, but not hillo
pattern
- - match patternStream<String> getKeysStreamByPattern(String pattern, int count)
count
keys per request.
Supported glob-style patterns:
h?llo subscribes to hello, hallo and hxllo
h*llo subscribes to hllo and heeeello
h[ae]llo subscribes to hello and hallo, but not hillo
pattern
- - match patterncount
- - keys loaded per request to RedisStream<String> getKeysStream()
10
keys per request.Stream<String> getKeysStream(int count)
count
keys per request.count
- - keys loaded per request to RedisString randomKey()
@Deprecated Collection<String> findKeysByPattern(String pattern)
long deleteByPattern(String pattern)
Method executes in NON atomic way in cluster mode due to lua script limitations.
Supported glob-style patterns: h?llo subscribes to hello, hallo and hxllo h*llo subscribes to hllo and heeeello h[ae]llo subscribes to hello and hallo, but not hillo
pattern
- - match patternlong delete(RObject... objects)
objects
- of Redissonlong delete(String... keys)
keys
- - object nameslong unlink(String... keys)
Requires Redis 4.0+
keys
- of objectslong count()
void flushdb()
void flushdbParallel()
Requires Redis 4.0+
void flushall()
void flushallParallel()
Requires Redis 4.0+
Copyright © 2014–2018 The Redisson Project. All rights reserved.