public class RedissonKeys extends Object implements RKeys
| Constructor and Description |
|---|
RedissonKeys(CommandAsyncExecutor commandExecutor) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
clearExpire(String name)
Clear an expire timeout or expire date for object.
|
RFuture<Boolean> |
clearExpireAsync(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
|
RFuture<Void> |
copyAsync(String name,
String host,
int port,
int database,
long timeout)
Copy object from source Redis instance to destination Redis instance
in async mode
|
long |
count()
Returns the number of keys in the currently-selected database
|
RFuture<Long> |
countAsync()
Returns the number of keys in the currently-selected database in async mode
|
long |
countExists(String... names)
Checks if provided keys exist
|
RFuture<Long> |
countExistsAsync(String... names)
Checks if provided keys exist
|
long |
delete(RObject... objects)
Delete multiple objects
|
long |
delete(String... keys)
Delete multiple objects by name
|
RFuture<Long> |
deleteAsync(RObject... objects)
Delete multiple objects
|
RFuture<Long> |
deleteAsync(String... keys)
Delete multiple objects by name
|
long |
deleteByPattern(String pattern)
Delete multiple objects by a key pattern.
|
RFuture<Long> |
deleteByPatternAsync(String pattern)
Delete multiple objects by a key pattern.
|
boolean |
expire(String name,
long timeToLive,
TimeUnit timeUnit)
Set a timeout for object.
|
RFuture<Boolean> |
expireAsync(String name,
long timeToLive,
TimeUnit timeUnit)
Set a timeout for object.
|
boolean |
expireAt(String name,
long timestamp)
Set an expire date for object.
|
RFuture<Boolean> |
expireAtAsync(String name,
long timestamp)
Set an expire date for object.
|
Collection<String> |
findKeysByPattern(String pattern) |
RFuture<Collection<String>> |
findKeysByPatternAsync(String pattern) |
void |
flushall()
Delete all keys of all existing databases
|
RFuture<Void> |
flushallAsync()
Delete all keys of all existing databases
|
void |
flushallParallel()
Delete all keys of all existing databases
in background without blocking server.
|
RFuture<Void> |
flushallParallelAsync()
Delete all keys of all existing databases
in background without blocking server.
|
void |
flushdb()
Delete all keys of currently selected database
|
RFuture<Void> |
flushdbAsync()
Delete all keys of currently selected database
|
void |
flushdbParallel()
Delete all keys of currently selected database
in background without blocking server.
|
RFuture<Void> |
flushdbParallelAsync()
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.
|
int |
getSlot(String key)
Get hash slot identifier for key.
|
RFuture<Integer> |
getSlotAsync(String key)
Get hash slot identifier for key in async mode.
|
RType |
getType(String key)
Get Redis object type by key
|
RFuture<RType> |
getTypeAsync(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
|
RFuture<Void> |
migrateAsync(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
|
RFuture<Boolean> |
moveAsync(String name,
int database)
Move object to another database
|
String |
randomKey()
Get random key
|
RFuture<String> |
randomKeyAsync()
Get random key in async mode
|
long |
remainTimeToLive(String name)
Remaining time to live of Redisson object that has a timeout
|
RFuture<Long> |
remainTimeToLiveAsync(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 |
RFuture<Void> |
renameAsync(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 |
RFuture<Boolean> |
renamenxAsync(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.
|
RFuture<Long> |
touchAsync(String... names)
Update the last access time of an object.
|
long |
unlink(String... keys)
Delete multiple objects by name.
|
RFuture<Long> |
unlinkAsync(String... keys)
Delete multiple objects by name.
|
public RedissonKeys(CommandAsyncExecutor commandExecutor)
public RType getType(String key)
RKeyspublic RFuture<RType> getTypeAsync(String key)
RKeysAsyncgetTypeAsync in interface RKeysAsynckey - - name of keypublic int getSlot(String key)
RKeyspublic RFuture<Integer> getSlotAsync(String key)
RKeysAsyncgetSlotAsync in interface RKeysAsynckey - - name of keypublic Iterable<String> getKeysByPattern(String pattern)
RKeysSupported 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
getKeysByPattern in interface RKeyspattern - - match patternpublic Iterable<String> getKeysByPattern(String pattern, int count)
RKeyscount 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
getKeysByPattern in interface RKeyspattern - - match patterncount - - keys loaded per request to Redispublic Iterable<String> getKeys()
RKeys10 keys per request.public Iterable<String> getKeys(int count)
RKeyscount keys per request.public long touch(String... names)
RKeyspublic RFuture<Long> touchAsync(String... names)
RKeysAsynctouchAsync in interface RKeysAsyncnames - of keyspublic long countExists(String... names)
RKeyscountExists in interface RKeysnames - of keyspublic RFuture<Long> countExistsAsync(String... names)
RKeysAsynccountExistsAsync in interface RKeysAsyncnames - of keyspublic RFuture<String> randomKeyAsync()
RKeysAsyncrandomKeyAsync in interface RKeysAsyncpublic Collection<String> findKeysByPattern(String pattern)
findKeysByPattern in interface RKeyspublic RFuture<Collection<String>> findKeysByPatternAsync(String pattern)
findKeysByPatternAsync in interface RKeysAsyncpublic long deleteByPattern(String pattern)
RKeysMethod 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
deleteByPattern in interface RKeyspattern - - match patternpublic RFuture<Long> deleteByPatternAsync(String pattern)
RKeysAsyncMethod 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
deleteByPatternAsync in interface RKeysAsyncpattern - - match patternpublic long delete(String... keys)
RKeyspublic long delete(RObject... objects)
RKeyspublic RFuture<Long> deleteAsync(RObject... objects)
RKeysAsyncdeleteAsync in interface RKeysAsyncobjects - of Redissonpublic long unlink(String... keys)
RKeysRequires Redis 4.0+
public RFuture<Long> unlinkAsync(String... keys)
RKeysAsyncRequires Redis 4.0+
unlinkAsync in interface RKeysAsynckeys - - object namespublic RFuture<Long> deleteAsync(String... keys)
RKeysAsyncdeleteAsync in interface RKeysAsynckeys - - object namespublic long count()
RKeyspublic RFuture<Long> countAsync()
RKeysAsynccountAsync in interface RKeysAsyncpublic void flushdbParallel()
RKeysRequires Redis 4.0+
flushdbParallel in interface RKeyspublic RFuture<Void> flushdbParallelAsync()
RKeysAsyncRequires Redis 4.0+
flushdbParallelAsync in interface RKeysAsyncpublic void flushallParallel()
RKeysRequires Redis 4.0+
flushallParallel in interface RKeyspublic RFuture<Void> flushallParallelAsync()
RKeysAsyncRequires Redis 4.0+
flushallParallelAsync in interface RKeysAsyncpublic void flushdb()
RKeyspublic RFuture<Void> flushdbAsync()
RKeysAsyncflushdbAsync in interface RKeysAsyncpublic void flushall()
RKeyspublic RFuture<Void> flushallAsync()
RKeysAsyncflushallAsync in interface RKeysAsyncpublic long remainTimeToLive(String name)
RKeysremainTimeToLive in interface RKeysname - of keypublic RFuture<Long> remainTimeToLiveAsync(String name)
RKeysAsyncremainTimeToLiveAsync in interface RKeysAsyncname - of keypublic void rename(String currentName, String newName)
RKeysnewNamepublic RFuture<Void> renameAsync(String currentName, String newName)
RKeysAsyncnewNamerenameAsync in interface RKeysAsynccurrentName - - current name of objectnewName - - new name of objectpublic boolean renamenx(String oldName, String newName)
RKeysoldName to newName
only if new key is not existspublic RFuture<Boolean> renamenxAsync(String oldName, String newName)
RKeysAsyncoldName to newName
only if new key is not existsrenamenxAsync in interface RKeysAsyncoldName - - old name of objectnewName - - new name of objecttrue if object has been renamed successfully and false otherwisepublic boolean clearExpire(String name)
RKeysclearExpire in interface RKeysname - of objecttrue if timeout was removed
false if object does not exist or does not have an associated timeoutpublic RFuture<Boolean> clearExpireAsync(String name)
RKeysAsyncclearExpireAsync in interface RKeysAsyncname - of objecttrue if timeout was removed
false if object does not exist or does not have an associated timeoutpublic boolean expireAt(String name, long timestamp)
RKeyspublic RFuture<Boolean> expireAtAsync(String name, long timestamp)
RKeysAsyncexpireAtAsync in interface RKeysAsyncname - of objecttimestamp - - expire date in milliseconds (Unix timestamp)true if the timeout was set and false if notpublic boolean expire(String name, long timeToLive, TimeUnit timeUnit)
RKeyspublic RFuture<Boolean> expireAsync(String name, long timeToLive, TimeUnit timeUnit)
RKeysAsyncexpireAsync in interface RKeysAsyncname - of objecttimeToLive - - timeout before object will be deletedtimeUnit - - timeout time unittrue if the timeout was set and false if notpublic void migrate(String name, String host, int port, int database, long timeout)
RKeyspublic RFuture<Void> migrateAsync(String name, String host, int port, int database, long timeout)
RKeysAsyncmigrateAsync in interface RKeysAsyncname - of objecthost - - destination hostport - - destination portdatabase - - destination databasetimeout - - maximum idle time in any moment of the communication with the destination instance in millisecondspublic void copy(String name, String host, int port, int database, long timeout)
RKeyspublic RFuture<Void> copyAsync(String name, String host, int port, int database, long timeout)
RKeysAsynccopyAsync in interface RKeysAsyncname - of objecthost - - destination hostport - - destination portdatabase - - destination databasetimeout - - maximum idle time in any moment of the communication with the destination instance in millisecondspublic boolean move(String name, int database)
RKeyspublic RFuture<Boolean> moveAsync(String name, int database)
RKeysAsyncmoveAsync in interface RKeysAsyncname - of objectdatabase - - Redis database numbertrue if key was moved else falseCopyright © 2014–2018 The Redisson Project. All rights reserved.