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.
|
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)
Find keys by key search pattern at once using KEYS command.
|
RFuture<Collection<String>> |
findKeysByPatternAsync(String pattern)
Find keys by key search pattern in async mode
Supported glob-style patterns:
h?
|
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> |
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)
Transfer an object from source Redis instance to destination Redis instance
|
RFuture<Void> |
migrateAsync(String name,
String host,
int port,
int database)
Transfer an 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)
RKeys
public RFuture<RType> getTypeAsync(String key)
RKeysAsync
getTypeAsync
in interface RKeysAsync
key
- - name of keypublic int getSlot(String key)
RKeys
public RFuture<Integer> getSlotAsync(String key)
RKeysAsync
getSlotAsync
in interface RKeysAsync
key
- - name of keypublic Iterable<String> getKeysByPattern(String pattern)
RKeys
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 RKeys
pattern
- - match patternpublic Iterable<String> getKeysByPattern(String pattern, int count)
RKeys
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
getKeysByPattern
in interface RKeys
pattern
- - match patterncount
- - keys loaded per request to Redispublic Iterable<String> getKeys()
RKeys
public long touch(String... names)
RKeys
public RFuture<Long> touchAsync(String... names)
RKeysAsync
touchAsync
in interface RKeysAsync
names
- of keyspublic long countExists(String... names)
RKeys
countExists
in interface RKeys
names
- of keyspublic RFuture<Long> countExistsAsync(String... names)
RKeysAsync
countExistsAsync
in interface RKeysAsync
names
- of keyspublic RFuture<String> randomKeyAsync()
RKeysAsync
randomKeyAsync
in interface RKeysAsync
public Collection<String> findKeysByPattern(String pattern)
RKeys
findKeysByPattern
in interface RKeys
pattern
- - match patternpublic RFuture<Collection<String>> findKeysByPatternAsync(String pattern)
RKeysAsync
findKeysByPatternAsync
in interface RKeysAsync
pattern
- - match patternpublic long deleteByPattern(String pattern)
RKeys
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
deleteByPattern
in interface RKeys
pattern
- - match patternpublic RFuture<Long> deleteByPatternAsync(String pattern)
RKeysAsync
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
deleteByPatternAsync
in interface RKeysAsync
pattern
- - match patternpublic long delete(String... keys)
RKeys
public long delete(RObject... objects)
RKeys
public RFuture<Long> deleteAsync(RObject... objects)
RKeysAsync
deleteAsync
in interface RKeysAsync
objects
- of Redissonpublic long unlink(String... keys)
RKeys
Requires Redis 4.0+
public RFuture<Long> unlinkAsync(String... keys)
RKeysAsync
Requires Redis 4.0+
unlinkAsync
in interface RKeysAsync
keys
- - object namespublic RFuture<Long> deleteAsync(String... keys)
RKeysAsync
deleteAsync
in interface RKeysAsync
keys
- - object namespublic long count()
RKeys
public RFuture<Long> countAsync()
RKeysAsync
countAsync
in interface RKeysAsync
public void flushdbParallel()
RKeys
Requires Redis 4.0+
flushdbParallel
in interface RKeys
public RFuture<Void> flushdbParallelAsync()
RKeysAsync
Requires Redis 4.0+
flushdbParallelAsync
in interface RKeysAsync
public void flushallParallel()
RKeys
Requires Redis 4.0+
flushallParallel
in interface RKeys
public RFuture<Void> flushallParallelAsync()
RKeysAsync
Requires Redis 4.0+
flushallParallelAsync
in interface RKeysAsync
public void flushdb()
RKeys
public RFuture<Void> flushdbAsync()
RKeysAsync
flushdbAsync
in interface RKeysAsync
public void flushall()
RKeys
public RFuture<Void> flushallAsync()
RKeysAsync
flushallAsync
in interface RKeysAsync
public long remainTimeToLive(String name)
RKeys
remainTimeToLive
in interface RKeys
name
- of keypublic RFuture<Long> remainTimeToLiveAsync(String name)
RKeysAsync
remainTimeToLiveAsync
in interface RKeysAsync
name
- of keypublic void rename(String currentName, String newName)
RKeys
newName
public RFuture<Void> renameAsync(String currentName, String newName)
RKeysAsync
newName
renameAsync
in interface RKeysAsync
currentName
- - current name of objectnewName
- - new name of objectpublic boolean renamenx(String oldName, String newName)
RKeys
oldName
to newName
only if new key is not existspublic RFuture<Boolean> renamenxAsync(String oldName, String newName)
RKeysAsync
oldName
to newName
only if new key is not existsrenamenxAsync
in interface RKeysAsync
oldName
- - old name of objectnewName
- - new name of objecttrue
if object has been renamed successfully and false
otherwisepublic boolean clearExpire(String name)
RKeys
clearExpire
in interface RKeys
name
- of objecttrue
if timeout was removed
false
if object does not exist or does not have an associated timeoutpublic RFuture<Boolean> clearExpireAsync(String name)
RKeysAsync
clearExpireAsync
in interface RKeysAsync
name
- 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)
RKeys
public RFuture<Boolean> expireAtAsync(String name, long timestamp)
RKeysAsync
expireAtAsync
in interface RKeysAsync
name
- 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)
RKeys
public RFuture<Boolean> expireAsync(String name, long timeToLive, TimeUnit timeUnit)
RKeysAsync
expireAsync
in interface RKeysAsync
name
- 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)
RKeys
public RFuture<Void> migrateAsync(String name, String host, int port, int database)
RKeysAsync
migrateAsync
in interface RKeysAsync
name
- of objecthost
- - destination hostport
- - destination portdatabase
- - destination databasepublic boolean move(String name, int database)
RKeys
public RFuture<Boolean> moveAsync(String name, int database)
RKeysAsync
moveAsync
in interface RKeysAsync
name
- of objectdatabase
- - Redis database numbertrue
if key was moved else false
Copyright © 2014–2018 The Redisson Project. All rights reserved.