K
- Key type.V
- Value type.public interface RedisKeyCommands<K,V>
Modifier and Type | Method and Description |
---|---|
Long |
del(K... keys)
Delete one or more keys.
|
byte[] |
dump(K key)
Return a serialized version of the value stored at the specified key.
|
Long |
exists(K... keys)
Determine how many keys exist.
|
Boolean |
expire(K key,
long seconds)
Set a key's time to live in seconds.
|
Boolean |
expireat(K key,
Date timestamp)
Set the expiration for a key as a UNIX timestamp.
|
Boolean |
expireat(K key,
long timestamp)
Set the expiration for a key as a UNIX timestamp.
|
List<K> |
keys(K pattern)
Find all keys matching the given pattern.
|
Long |
keys(KeyStreamingChannel<K> channel,
K pattern)
Find all keys matching the given pattern.
|
String |
migrate(String host,
int port,
int db,
long timeout,
MigrateArgs<K> migrateArgs)
Atomically transfer one or more keys from a Redis instance to another one.
|
String |
migrate(String host,
int port,
K key,
int db,
long timeout)
Atomically transfer a key from a Redis instance to another one.
|
Boolean |
move(K key,
int db)
Move a key to another database.
|
String |
objectEncoding(K key)
returns the kind of internal representation used in order to store the value associated with a key.
|
Long |
objectIdletime(K key)
returns the number of seconds since the object stored at the specified key is idle (not requested by read or write
operations).
|
Long |
objectRefcount(K key)
returns the number of references of the value associated with the specified key.
|
Boolean |
persist(K key)
Remove the expiration from a key.
|
Boolean |
pexpire(K key,
long milliseconds)
Set a key's time to live in milliseconds.
|
Boolean |
pexpireat(K key,
Date timestamp)
Set the expiration for a key as a UNIX timestamp specified in milliseconds.
|
Boolean |
pexpireat(K key,
long timestamp)
Set the expiration for a key as a UNIX timestamp specified in milliseconds.
|
Long |
pttl(K key)
Get the time to live for a key in milliseconds.
|
K |
randomkey()
Return a random key from the keyspace.
|
String |
rename(K key,
K newKey)
Rename a key.
|
Boolean |
renamenx(K key,
K newKey)
Rename a key, only if the new key does not exist.
|
String |
restore(K key,
byte[] value,
RestoreArgs args)
Create a key using the provided serialized value, previously obtained using DUMP.
|
String |
restore(K key,
long ttl,
byte[] value)
Create a key using the provided serialized value, previously obtained using DUMP.
|
KeyScanCursor<K> |
scan()
Incrementally iterate the keys space.
|
StreamScanCursor |
scan(KeyStreamingChannel<K> channel)
Incrementally iterate the keys space.
|
StreamScanCursor |
scan(KeyStreamingChannel<K> channel,
ScanArgs scanArgs)
Incrementally iterate the keys space.
|
StreamScanCursor |
scan(KeyStreamingChannel<K> channel,
ScanCursor scanCursor)
Incrementally iterate the keys space.
|
StreamScanCursor |
scan(KeyStreamingChannel<K> channel,
ScanCursor scanCursor,
ScanArgs scanArgs)
Incrementally iterate the keys space.
|
KeyScanCursor<K> |
scan(ScanArgs scanArgs)
Incrementally iterate the keys space.
|
KeyScanCursor<K> |
scan(ScanCursor scanCursor)
Incrementally iterate the keys space.
|
KeyScanCursor<K> |
scan(ScanCursor scanCursor,
ScanArgs scanArgs)
Incrementally iterate the keys space.
|
List<V> |
sort(K key)
Sort the elements in a list, set or sorted set.
|
List<V> |
sort(K key,
SortArgs sortArgs)
Sort the elements in a list, set or sorted set.
|
Long |
sort(ValueStreamingChannel<V> channel,
K key)
Sort the elements in a list, set or sorted set.
|
Long |
sort(ValueStreamingChannel<V> channel,
K key,
SortArgs sortArgs)
Sort the elements in a list, set or sorted set.
|
Long |
sortStore(K key,
SortArgs sortArgs,
K destination)
Sort the elements in a list, set or sorted set.
|
Long |
touch(K... keys)
Touch one or more keys.
|
Long |
ttl(K key)
Get the time to live for a key.
|
String |
type(K key)
Determine the type stored at key.
|
Long |
unlink(K... keys)
Unlink one or more keys (non blocking DEL).
|
Long del(K... keys)
keys
- the keys.Long unlink(K... keys)
keys
- the keys.byte[] dump(K key)
key
- the key.Long exists(K... keys)
keys
- the keys.Boolean expire(K key, long seconds)
key
- the key.seconds
- the seconds type: long.true
if the timeout was set. false
if key
does not exist or the timeout could not be set.Boolean expireat(K key, Date timestamp)
key
- the key.timestamp
- the timestamp type: posix time.true
if the timeout was set. false
if key
does not exist or the timeout could not be set
(see: EXPIRE
).Boolean expireat(K key, long timestamp)
key
- the key.timestamp
- the timestamp type: posix time.true
if the timeout was set. false
if key
does not exist or the timeout could not be set
(see: EXPIRE
).List<K> keys(K pattern)
pattern
- the pattern type: patternkey (pattern).pattern
.Long keys(KeyStreamingChannel<K> channel, K pattern)
channel
- the channel.pattern
- the pattern.pattern
.String migrate(String host, int port, K key, int db, long timeout)
host
- the host.port
- the port.key
- the key.db
- the database.timeout
- the timeout in milliseconds.String migrate(String host, int port, int db, long timeout, MigrateArgs<K> migrateArgs)
host
- the host.port
- the port.db
- the database.timeout
- the timeout in milliseconds.migrateArgs
- migrate args that allow to configure further options.Boolean move(K key, int db)
key
- the key.db
- the db type: long.String objectEncoding(K key)
key
- the key.Long objectIdletime(K key)
key
- the key.Long objectRefcount(K key)
key
- the key.Boolean persist(K key)
key
- the key.true
if the timeout was removed. false
if key
does not exist or does not have an
associated timeout.Boolean pexpire(K key, long milliseconds)
key
- the key.milliseconds
- the milliseconds type: long.true
if the timeout was set. false
if key
does not exist or the timeout could not be set.Boolean pexpireat(K key, Date timestamp)
key
- the key.timestamp
- the milliseconds-timestamp type: posix time.true
if the timeout was set. false
if key
does not exist or the timeout could not be set
(see: EXPIRE
).Boolean pexpireat(K key, long timestamp)
key
- the key.timestamp
- the milliseconds-timestamp type: posix time.true
if the timeout was set. false
if key
does not exist or the timeout could not be set
(see: EXPIRE
).Long pttl(K key)
key
- the key.K randomkey()
null
when the database is empty.String rename(K key, K newKey)
key
- the key.newKey
- the newkey type: key.Boolean renamenx(K key, K newKey)
key
- the key.newKey
- the newkey type: key.true
if key
was renamed to newkey
. false
if newkey
already exists.String restore(K key, long ttl, byte[] value)
key
- the key.ttl
- the ttl type: long.value
- the serialized-value type: string.String restore(K key, byte[] value, RestoreArgs args)
key
- the key.value
- the serialized-value type: string.args
- the RestoreArgs
, must not be null
.List<V> sort(K key)
key
- the key.Long sort(ValueStreamingChannel<V> channel, K key)
channel
- streaming channel that receives a call for every value.key
- the key.List<V> sort(K key, SortArgs sortArgs)
key
- the key.sortArgs
- sort arguments.Long sort(ValueStreamingChannel<V> channel, K key, SortArgs sortArgs)
channel
- streaming channel that receives a call for every value.key
- the key.sortArgs
- sort arguments.Long sortStore(K key, SortArgs sortArgs, K destination)
key
- the key.sortArgs
- sort arguments.destination
- the destination key to store sort results.Long touch(K... keys)
keys
- the keys.Long ttl(K key)
key
- the key.String type(K key)
key
- the key.key
, or none
when key
does not exist.KeyScanCursor<K> scan()
KeyScanCursor<K> scan(ScanArgs scanArgs)
scanArgs
- scan arguments.KeyScanCursor<K> scan(ScanCursor scanCursor, ScanArgs scanArgs)
scanCursor
- cursor to resume from a previous scan, must not be null
.scanArgs
- scan arguments.KeyScanCursor<K> scan(ScanCursor scanCursor)
scanCursor
- cursor to resume from a previous scan, must not be null
.StreamScanCursor scan(KeyStreamingChannel<K> channel)
channel
- streaming channel that receives a call for every key.StreamScanCursor scan(KeyStreamingChannel<K> channel, ScanArgs scanArgs)
channel
- streaming channel that receives a call for every key.scanArgs
- scan arguments.StreamScanCursor scan(KeyStreamingChannel<K> channel, ScanCursor scanCursor, ScanArgs scanArgs)
channel
- streaming channel that receives a call for every key.scanCursor
- cursor to resume from a previous scan, must not be null
.scanArgs
- scan arguments.StreamScanCursor scan(KeyStreamingChannel<K> channel, ScanCursor scanCursor)
channel
- streaming channel that receives a call for every key.scanCursor
- cursor to resume from a previous scan, must not be null
.Copyright © 2021 lettuce.io. All rights reserved.