Package org.redisson.api
Interface RKeysReactive
-
public interface RKeysReactive
- Author:
- Nikita Koksharov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description org.reactivestreams.Publisher<Boolean>
clearExpire(String name)
Clear an expire timeout or expire date for object.org.reactivestreams.Publisher<Void>
copy(String name, String host, int port, int database, long timeout)
Copy object from source Redis instance to destination Redis instanceorg.reactivestreams.Publisher<Long>
count()
Returns the number of keys in the currently-selected databaseorg.reactivestreams.Publisher<Long>
countExists(String... names)
Checks if provided keys existorg.reactivestreams.Publisher<Long>
delete(String... keys)
Delete multiple objects by name.org.reactivestreams.Publisher<Long>
deleteByPattern(String pattern)
Delete multiple objects by a key pattern.org.reactivestreams.Publisher<Boolean>
expire(String name, long timeToLive, TimeUnit timeUnit)
Set a timeout for object.org.reactivestreams.Publisher<Boolean>
expireAt(String name, long timestamp)
Set an expire date for object.org.reactivestreams.Publisher<Collection<String>>
findKeysByPattern(String pattern)
Find keys by key search pattern by one Redis call.org.reactivestreams.Publisher<Void>
flushall()
Delete all the keys of all the existing databases UsesFLUSHALL
Redis command.org.reactivestreams.Publisher<Void>
flushdb()
Delete all the keys of the currently selected database UsesFLUSHDB
Redis command.org.reactivestreams.Publisher<String>
getKeys()
Load keys in incrementally iterate mode.org.reactivestreams.Publisher<String>
getKeys(int count)
Load keys in incrementally iterate mode.org.reactivestreams.Publisher<String>
getKeysByPattern(String pattern)
Find keys by pattern and load it in incrementally iterate mode.org.reactivestreams.Publisher<String>
getKeysByPattern(String pattern, int count)
Get all keys by pattern using iterator.org.reactivestreams.Publisher<Integer>
getSlot(String key)
Get hash slot identifier for key.org.reactivestreams.Publisher<RType>
getType(String key)
Get Redis object type by keyorg.reactivestreams.Publisher<Void>
migrate(String name, String host, int port, int database, long timeout)
Transfer object from source Redis instance to destination Redis instanceorg.reactivestreams.Publisher<Boolean>
move(String name, int database)
Move object to another databaseorg.reactivestreams.Publisher<String>
randomKey()
Get random key UsesRANDOM_KEY
Redis command.org.reactivestreams.Publisher<Long>
remainTimeToLive(String name)
Remaining time to live of Redisson object that has a timeoutorg.reactivestreams.Publisher<Void>
rename(String currentName, String newName)
Rename current object key tonewName
org.reactivestreams.Publisher<Boolean>
renamenx(String oldName, String newName)
Rename object witholdName
tonewName
only if new key is not existsorg.reactivestreams.Publisher<Long>
touch(String... names)
Update the last access time of an object.org.reactivestreams.Publisher<Long>
unlink(String... keys)
Delete multiple objects by name.
-
-
-
Method Detail
-
move
org.reactivestreams.Publisher<Boolean> move(String name, int database)
Move object to another database- Parameters:
name
- of objectdatabase
- - Redis database number- Returns:
true
if key was moved elsefalse
-
migrate
org.reactivestreams.Publisher<Void> migrate(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
-
copy
org.reactivestreams.Publisher<Void> copy(String name, String host, int port, int database, long timeout)
Copy 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
-
expire
org.reactivestreams.Publisher<Boolean> expire(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
-
expireAt
org.reactivestreams.Publisher<Boolean> expireAt(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
-
clearExpire
org.reactivestreams.Publisher<Boolean> clearExpire(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
-
renamenx
org.reactivestreams.Publisher<Boolean> renamenx(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
-
rename
org.reactivestreams.Publisher<Void> rename(String currentName, String newName)
Rename current object key tonewName
- Parameters:
currentName
- - current name of objectnewName
- - new name of object- Returns:
- void
-
remainTimeToLive
org.reactivestreams.Publisher<Long> remainTimeToLive(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.
-
touch
org.reactivestreams.Publisher<Long> touch(String... names)
Update the last access time of an object.- Parameters:
names
- of keys- Returns:
- count of objects were touched
-
countExists
org.reactivestreams.Publisher<Long> countExists(String... names)
Checks if provided keys exist- Parameters:
names
- of keys- Returns:
- amount of existing keys
-
getType
org.reactivestreams.Publisher<RType> getType(String key)
Get Redis object type by key- Parameters:
key
- - name of key- Returns:
- type of key
-
getKeys
org.reactivestreams.Publisher<String> getKeys()
Load keys in incrementally iterate mode. Keys traversed with SCAN operation. Each SCAN operation loads up to 10 keys per request.- Returns:
- keys
-
getKeys
org.reactivestreams.Publisher<String> getKeys(int count)
Load keys in incrementally iterate mode. Keys traversed with SCAN operation. Each SCAN operation loads up tocount
keys per request.- Parameters:
count
- - keys loaded per request to Redis- Returns:
- keys
-
getKeysByPattern
org.reactivestreams.Publisher<String> getKeysByPattern(String pattern)
Find keys by pattern and load it in incrementally iterate mode. Keys traversed with SCAN operation. Each SCAN operation loads up to 10 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
- Parameters:
pattern
- - match pattern- Returns:
- keys
-
getKeysByPattern
org.reactivestreams.Publisher<String> getKeysByPattern(String pattern, int count)
Get all keys by pattern using iterator. Keys traversed with SCAN operation. Each SCAN operation loads up tocount
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
- Parameters:
pattern
- - match patterncount
- - keys loaded per request to Redis- Returns:
- keys
-
getSlot
org.reactivestreams.Publisher<Integer> getSlot(String key)
Get hash slot identifier for key. Available for cluster nodes only. UsesKEYSLOT
Redis command.- Parameters:
key
- - name of key- Returns:
- slot number
-
findKeysByPattern
org.reactivestreams.Publisher<Collection<String>> findKeysByPattern(String pattern)
Find keys by key search pattern by one Redis call. UsesKEYS
Redis command. 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:
- collection of keys
-
randomKey
org.reactivestreams.Publisher<String> randomKey()
Get random key UsesRANDOM_KEY
Redis command.- Returns:
- random key
-
deleteByPattern
org.reactivestreams.Publisher<Long> deleteByPattern(String pattern)
Delete multiple objects by a key pattern. Uses Lua script. 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:
- deleted objects amount
-
delete
org.reactivestreams.Publisher<Long> delete(String... keys)
Delete multiple objects by name. UsesDEL
Redis command.- Parameters:
keys
- - object names- Returns:
- deleted objects amount
-
unlink
org.reactivestreams.Publisher<Long> unlink(String... keys)
Delete multiple objects by name. Actual removal will happen later asynchronously.Requires Redis 4.0+
- Parameters:
keys
- of objects- Returns:
- number of removed keys
-
count
org.reactivestreams.Publisher<Long> count()
Returns the number of keys in the currently-selected database- Returns:
- count of keys
-
flushdb
org.reactivestreams.Publisher<Void> flushdb()
Delete all the keys of the currently selected database UsesFLUSHDB
Redis command.- Returns:
- void
-
flushall
org.reactivestreams.Publisher<Void> flushall()
Delete all the keys of all the existing databases UsesFLUSHALL
Redis command.- Returns:
- void
-
-