Package org.redisson.api
Interface RKeysAsync
-
- All Known Subinterfaces:
RKeys
- All Known Implementing Classes:
RedissonKeys
public interface RKeysAsync
- Author:
- Nikita Koksharov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description RFuture<Boolean>
clearExpireAsync(String name)
Clear an expire timeout or expire date for object.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 modeRFuture<Long>
countAsync()
Returns the number of keys in the currently-selected database in async modeRFuture<Long>
countExistsAsync(String... names)
Checks if provided keys existRFuture<Long>
deleteAsync(String... keys)
Delete multiple objects by nameRFuture<Long>
deleteAsync(RObject... objects)
Delete multiple objectsRFuture<Long>
deleteByPatternAsync(String pattern)
Delete multiple objects by a key pattern.RFuture<Boolean>
expireAsync(String name, long timeToLive, TimeUnit timeUnit)
Set a timeout for object.RFuture<Boolean>
expireAtAsync(String name, long timestamp)
Set an expire date for object.RFuture<Void>
flushallAsync()
Delete all keys of all existing databasesRFuture<Void>
flushallParallelAsync()
Delete all keys of all existing databases in background without blocking server.RFuture<Void>
flushdbAsync()
Delete all keys of currently selected databaseRFuture<Void>
flushdbParallelAsync()
Delete all keys of currently selected database in background without blocking server.RFuture<Integer>
getSlotAsync(String key)
Get hash slot identifier for key in async mode.RFuture<RType>
getTypeAsync(String key)
Get Redis object type by keyRFuture<Void>
migrateAsync(String name, String host, int port, int database, long timeout)
Transfer object from source Redis instance to destination Redis instanceRFuture<Boolean>
moveAsync(String name, int database)
Move object to another databaseRFuture<String>
randomKeyAsync()
Get random key in async modeRFuture<Long>
remainTimeToLiveAsync(String name)
Remaining time to live of Redisson object that has a timeoutRFuture<Void>
renameAsync(String currentName, String newName)
Rename current object key tonewName
RFuture<Boolean>
renamenxAsync(String oldName, String newName)
Rename object witholdName
tonewName
only if new key is not existsRFuture<Void>
swapdbAsync(int db1, int db2)
Swap two databases.RFuture<Long>
touchAsync(String... names)
Update the last access time of an object.RFuture<Long>
unlinkAsync(String... keys)
Delete multiple objects by name.
-
-
-
Method Detail
-
moveAsync
RFuture<Boolean> moveAsync(String name, int database)
Move object to another database- Parameters:
name
- of objectdatabase
- - Redis database number- Returns:
true
if key was moved elsefalse
-
migrateAsync
RFuture<Void> migrateAsync(String name, String host, int port, int database, long timeout)
Transfer object from source Redis instance to destination Redis instance- Parameters:
name
- of objecthost
- - destination hostport
- - destination portdatabase
- - destination databasetimeout
- - maximum idle time in any moment of the communication with the destination instance in milliseconds- Returns:
- void
-
copyAsync
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- Parameters:
name
- of objecthost
- - destination hostport
- - destination portdatabase
- - destination databasetimeout
- - maximum idle time in any moment of the communication with the destination instance in milliseconds- Returns:
- void
-
expireAsync
RFuture<Boolean> expireAsync(String name, long timeToLive, TimeUnit timeUnit)
Set a timeout for object. After the timeout has expired, the key will automatically be deleted.- Parameters:
name
- of objecttimeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unit- Returns:
true
if the timeout was set andfalse
if not
-
expireAtAsync
RFuture<Boolean> expireAtAsync(String name, long timestamp)
Set an expire date for object. When expire date comes the key will automatically be deleted.- Parameters:
name
- of objecttimestamp
- - expire date in milliseconds (Unix timestamp)- Returns:
true
if the timeout was set andfalse
if not
-
clearExpireAsync
RFuture<Boolean> clearExpireAsync(String name)
Clear an expire timeout or expire date for object.- Parameters:
name
- of object- Returns:
true
if timeout was removedfalse
if object does not exist or does not have an associated timeout
-
renamenxAsync
RFuture<Boolean> renamenxAsync(String oldName, String newName)
Rename object witholdName
tonewName
only if new key is not exists- Parameters:
oldName
- - old name of objectnewName
- - new name of object- Returns:
true
if object has been renamed successfully andfalse
otherwise
-
renameAsync
RFuture<Void> renameAsync(String currentName, String newName)
Rename current object key tonewName
- Parameters:
currentName
- - current name of objectnewName
- - new name of object- Returns:
- void
-
remainTimeToLiveAsync
RFuture<Long> remainTimeToLiveAsync(String name)
Remaining time to live of Redisson object that has a timeout- Parameters:
name
- of key- Returns:
- time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
-
touchAsync
RFuture<Long> touchAsync(String... names)
Update the last access time of an object.- Parameters:
names
- of keys- Returns:
- count of objects were touched
-
countExistsAsync
RFuture<Long> countExistsAsync(String... names)
Checks if provided keys exist- Parameters:
names
- of keys- Returns:
- amount of existing keys
-
getTypeAsync
RFuture<RType> getTypeAsync(String key)
Get Redis object type by key- Parameters:
key
- - name of key- Returns:
- type of key
-
getSlotAsync
RFuture<Integer> getSlotAsync(String key)
Get hash slot identifier for key in async mode. Available for cluster nodes only- Parameters:
key
- - name of key- Returns:
- slot
-
deleteByPatternAsync
RFuture<Long> deleteByPatternAsync(String pattern)
Delete multiple objects by a key 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
- Parameters:
pattern
- - match pattern- Returns:
- number of removed keys
-
deleteAsync
RFuture<Long> deleteAsync(RObject... objects)
Delete multiple objects- Parameters:
objects
- of Redisson- Returns:
- number of removed keys
-
deleteAsync
RFuture<Long> deleteAsync(String... keys)
Delete multiple objects by name- Parameters:
keys
- - object names- Returns:
- number of removed keys
-
unlinkAsync
RFuture<Long> unlinkAsync(String... keys)
Delete multiple objects by name. Actual removal will happen later asynchronously.Requires Redis 4.0+
- Parameters:
keys
- - object names- Returns:
- number of removed keys
-
countAsync
RFuture<Long> countAsync()
Returns the number of keys in the currently-selected database in async mode- Returns:
- number of keys
-
swapdbAsync
RFuture<Void> swapdbAsync(int db1, int db2)
Swap two databases.Requires Redis 4.0+
- Returns:
- void
-
flushdbAsync
RFuture<Void> flushdbAsync()
Delete all keys of currently selected database- Returns:
- void
-
flushdbParallelAsync
RFuture<Void> flushdbParallelAsync()
Delete all keys of currently selected database in background without blocking server.Requires Redis 4.0+
- Returns:
- void
-
-