Package io.quarkus.redis.datasource.keys
Interface KeyCommands<K>
-
- Type Parameters:
K- the type of the keys, oftenString
- All Superinterfaces:
RedisCommands
- All Known Implementing Classes:
BlockingKeyCommandsImpl
public interface KeyCommands<K> extends RedisCommands
Allows executing commands manipulating keys. See the generic command list for further information about these commands.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancopy(K source, K destination)Execute the command COPY.booleancopy(K source, K destination, CopyArgs copyArgs)Execute the command COPY.intdel(K... keys)Execute the command DEL.Stringdump(K key)Execute the command DUMP.booleanexists(K key)Execute the command EXISTS.intexists(K... keys)Execute the command EXISTS.booleanexpire(K key, long seconds)Execute the command EXPIRE.booleanexpire(K key, long seconds, ExpireArgs expireArgs)Execute the command EXPIRE.booleanexpire(K key, Duration duration)Execute the command EXPIRE.booleanexpire(K key, Duration duration, ExpireArgs expireArgs)Execute the command EXPIRE.booleanexpireat(K key, long timestamp)Execute the command EXPIREAT.booleanexpireat(K key, long timestamp, ExpireArgs expireArgs)Execute the command EXPIREAT.booleanexpireat(K key, Instant timestamp)Execute the command EXPIREAT.booleanexpireat(K key, Instant timestamp, ExpireArgs expireArgs)Execute the command EXPIREAT.longexpiretime(K key)Execute the command EXPIRETIME.List<K>keys(String pattern)Execute the command KEYS.booleanmove(K key, long db)Execute the command MOVE.booleanpersist(K key)Execute the command PERSIST.booleanpexpire(K key, long ms)Execute the command PEXPIRE.booleanpexpire(K key, long milliseconds, ExpireArgs expireArgs)Execute the command PEXPIRE.booleanpexpire(K key, Duration duration)Execute the command PEXPIRE.booleanpexpire(K key, Duration duration, ExpireArgs expireArgs)Execute the command PEXPIRE.booleanpexpireat(K key, long timestamp)Execute the command PEXPIREAT.booleanpexpireat(K key, long timestamp, ExpireArgs expireArgs)Execute the command PEXPIREAT.booleanpexpireat(K key, Instant timestamp)Execute the command PEXPIREAT.booleanpexpireat(K key, Instant timestamp, ExpireArgs expireArgs)Execute the command PEXPIREAT.longpexpiretime(K key)Execute the command PEXPIRETIME.longpttl(K key)Execute the command PTTL.Krandomkey()Execute the command RANDOMKEY.voidrename(K key, K newkey)Execute the command RENAME.booleanrenamenx(K key, K newkey)Execute the command RENAMENX.KeyScanCursor<K>scan()Execute the command SCAN.KeyScanCursor<K>scan(KeyScanArgs args)Execute the command SCAN.inttouch(K... keys)Execute the command TOUCH.longttl(K key)Execute the command TTL.RedisValueTypetype(K key)Execute the command TYPE.intunlink(K... keys)Execute the command UNLINK.-
Methods inherited from interface io.quarkus.redis.datasource.RedisCommands
getDataSource
-
-
-
-
Method Detail
-
copy
boolean copy(K source, K destination)
Execute the command COPY. Summary: Copy a key Group: generic Requires Redis 6.2.0- Parameters:
source- the keydestination- the key- Returns:
truesource was copied.falsesource was not copied.
-
copy
boolean copy(K source, K destination, CopyArgs copyArgs)
Execute the command COPY. Summary: Copy a key Group: generic Requires Redis 6.2.0- Parameters:
source- the keydestination- the keycopyArgs- the additional arguments- Returns:
truesource was copied.falsesource was not copied.
-
del
int del(K... keys)
Execute the command DEL. Summary: Delete one or multiple keys Group: generic Requires Redis 1.0.0- Parameters:
keys- the keys.- Returns:
- The number of keys that were removed.
-
dump
String dump(K key)
Execute the command DUMP. Summary: Return a serialized version of the value stored at the specified key. Group: generic Requires Redis 2.6.0- Parameters:
key- the key- Returns:
- the serialized value.
-
exists
boolean exists(K key)
Execute the command EXISTS. Summary: Determine if a key exists Group: generic Requires Redis 1.0.0- Parameters:
key- the key to check- Returns:
trueif the key exists,falseotherwise
-
exists
int exists(K... keys)
Execute the command EXISTS. Summary: Determine if a key exists Group: generic Requires Redis 1.0.0- Parameters:
keys- the keys to check- Returns:
- the number of keys that exist from those specified as arguments.
-
expire
boolean expire(K key, long seconds, ExpireArgs expireArgs)
Execute the command EXPIRE. Summary: Set a key's time to live in seconds Group: generic Requires Redis 1.0.0- Parameters:
key- the keyseconds- the new TTLexpireArgs- theEXPIREcommand extra-arguments- Returns:
truethe timeout was set.falsethe timeout was not set. e.g. key doesn't exist, or operation skipped due to the provided arguments.
-
expire
boolean expire(K key, Duration duration, ExpireArgs expireArgs)
Execute the command EXPIRE. Summary: Set a key's time to live in seconds Group: generic Requires Redis 1.0.0- Parameters:
key- the keyduration- the new TTLexpireArgs- theEXPIREcommand extra-arguments- Returns:
truethe timeout was set.falsethe timeout was not set. e.g. key doesn't exist, or operation skipped due to the provided arguments.
-
expire
boolean expire(K key, long seconds)
Execute the command EXPIRE. Summary: Set a key's time to live in seconds Group: generic Requires Redis 1.0.0- Parameters:
key- the keyseconds- the new TTL- Returns:
truethe timeout was set.falsethe timeout was not set. e.g. key doesn't exist.
-
expire
boolean expire(K key, Duration duration)
Execute the command EXPIRE. Summary: Set a key's time to live in seconds Group: generic Requires Redis 1.0.0- Parameters:
key- the keyduration- the new TTL- Returns:
truethe timeout was set.falsethe timeout was not set. e.g. key doesn't exist.
-
expireat
boolean expireat(K key, long timestamp)
Execute the command EXPIREAT. Summary: Set the expiration for a key as a UNIX timestamp Group: generic Requires Redis 1.2.0- Parameters:
key- the keytimestamp- the timestamp- Returns:
truethe timeout was set.falsethe timeout was not set. e.g. key doesn't exist.
-
expireat
boolean expireat(K key, Instant timestamp)
Execute the command EXPIREAT. Summary: Set the expiration for a key as a UNIX timestamp Group: generic Requires Redis 1.2.0- Parameters:
key- the keytimestamp- the timestamp- Returns:
truethe timeout was set.falsethe timeout was not set. e.g. key doesn't exist.
-
expireat
boolean expireat(K key, long timestamp, ExpireArgs expireArgs)
Execute the command EXPIREAT. Summary: Set the expiration for a key as a UNIX timestamp Group: generic Requires Redis 1.2.0- Parameters:
key- the keytimestamp- the timestampexpireArgs- theEXPIREATcommand extra-arguments- Returns:
truethe timeout was set.falsethe timeout was not set. e.g. key doesn't exist, or operation skipped due to the provided arguments.
-
expireat
boolean expireat(K key, Instant timestamp, ExpireArgs expireArgs)
Execute the command EXPIREAT. Summary: Set the expiration for a key as a UNIX timestamp Group: generic Requires Redis 1.2.0- Parameters:
key- the keytimestamp- the timestampexpireArgs- theEXPIREATcommand extra-arguments- Returns:
truethe timeout was set.falsethe timeout was not set. e.g. key doesn't exist, or operation skipped due to the provided arguments.
-
expiretime
long expiretime(K key)
Execute the command EXPIRETIME. Summary: Get the expiration Unix timestamp for a key Group: generic Requires Redis 7.0.0- Parameters:
key- the key- Returns:
- the expiration Unix timestamp in seconds,
-1if the key exists but has no associated expiration time. - Throws:
RedisKeyNotFoundException- if the key does not exist
-
keys
List<K> keys(String pattern)
Execute the command KEYS. Summary: Find all keys matching the given pattern Group: generic Requires Redis 1.0.0- Parameters:
pattern- the glob-style pattern- Returns:
- the list of keys matching pattern.
-
move
boolean move(K key, long db)
Execute the command MOVE. Summary: Move a key to another database Group: generic Requires Redis 1.0.0- Parameters:
key- the key- Returns:
truekey was moved.falsekey was not moved.
-
persist
boolean persist(K key)
Execute the command PERSIST. Summary: Remove the expiration from a key Group: generic Requires Redis 2.2.0- Parameters:
key- the key- Returns:
truethe timeout was removed.falsekey does not exist or does not have an associated timeout.
-
pexpire
boolean pexpire(K key, Duration duration, ExpireArgs expireArgs)
Execute the command PEXPIRE. Summary: Set a key's time to live in milliseconds Group: generic Requires Redis 2.6.0- Parameters:
key- the keyduration- the new TTLexpireArgs- thePEXPIREcommand extra-arguments- Returns:
truethe timeout was set.falsethe timeout was not set. e.g. key doesn't exist, or operation skipped due to the provided arguments.
-
pexpire
boolean pexpire(K key, long ms)
Execute the command PEXPIRE. Summary: Set a key's time to live in milliseconds Group: generic Requires Redis 2.6.0- Parameters:
key- the keyms- the new TTL- Returns:
truethe timeout was set.falsethe timeout was not set. e.g. key doesn't exist.
-
pexpire
boolean pexpire(K key, Duration duration)
Execute the command PEXPIRE. Summary: Set a key's time to live in milliseconds Group: generic Requires Redis 2.6.0- Parameters:
key- the keyduration- the new TTL- Returns:
truethe timeout was set.falsethe timeout was not set. e.g. key doesn't exist.
-
pexpire
boolean pexpire(K key, long milliseconds, ExpireArgs expireArgs)
Execute the command PEXPIRE. Summary: Set a key's time to live in milliseconds Group: generic Requires Redis 2.6.0- Parameters:
key- the keymilliseconds- the new TTLexpireArgs- thePEXPIREcommand extra-arguments- Returns:
truethe timeout was set.falsethe timeout was not set. e.g. key doesn't exist.
-
pexpireat
boolean pexpireat(K key, long timestamp)
Execute the command PEXPIREAT. Summary: Set the expiration for a key as a UNIX timestamp Group: generic Requires Redis 2.6.0- Parameters:
key- the keytimestamp- the timestamp- Returns:
truethe timeout was set.falsethe timeout was not set. e.g. key doesn't exist.
-
pexpireat
boolean pexpireat(K key, Instant timestamp)
Execute the command PEXPIREAT. Summary: Set the expiration for a key as a UNIX timestamp Group: generic Requires Redis 2.6.0- Parameters:
key- the keytimestamp- the timestamp- Returns:
truethe timeout was set.falsethe timeout was not set. e.g. key doesn't exist.
-
pexpireat
boolean pexpireat(K key, long timestamp, ExpireArgs expireArgs)
Execute the command PEXPIREAT. Summary: Set the expiration for a key as a UNIX timestamp Group: generic Requires Redis 2.6.0- Parameters:
key- the keytimestamp- the timestampexpireArgs- theEXPIREATcommand extra-arguments- Returns:
truethe timeout was set.falsethe timeout was not set. e.g. key doesn't exist, or operation skipped due to the provided arguments.
-
pexpireat
boolean pexpireat(K key, Instant timestamp, ExpireArgs expireArgs)
Execute the command PEXPIREAT. Summary: Set the expiration for a key as a UNIX timestamp Group: generic Requires Redis 2.6.0- Parameters:
key- the keytimestamp- the timestampexpireArgs- theEXPIREATcommand extra-arguments- Returns:
truethe timeout was set.falsethe timeout was not set. e.g. key doesn't exist, or operation skipped due to the provided arguments.
-
pexpiretime
long pexpiretime(K key)
Execute the command PEXPIRETIME. Summary: Get the expiration Unix timestamp for a key Group: generic Requires Redis 2.6.0- Parameters:
key- the key- Returns:
- the expiration Unix timestamp in milliseconds;
-1if the key exists but has no associated expiration time. - Throws:
RedisKeyNotFoundException- if the key does not exist
-
pttl
long pttl(K key) throws RedisKeyNotFoundException
Execute the command PTTL. Summary: Get the time to live for a key in milliseconds Group: generic Requires Redis 2.6.0- Parameters:
key- the key- Returns:
- TTL in milliseconds. The command returns
-1if the key exists but has no associated expire. - Throws:
RedisKeyNotFoundException- if the key does not exist
-
randomkey
K randomkey()
Execute the command RANDOMKEY. Summary: Return a random key from the keyspace Group: generic Requires Redis 1.0.0- Returns:
- the random key, or
nullwhen the database is empty.
-
rename
void rename(K key, K newkey)
Execute the command RENAME. Summary: Rename a key Group: generic Requires Redis 1.0.0- Parameters:
key- the keynewkey- the new key
-
renamenx
boolean renamenx(K key, K newkey)
Execute the command RENAMENX. Summary: Rename a key, only if the new key does not exist Group: generic Requires Redis 1.0.0- Parameters:
key- the keynewkey- the new key- Returns:
trueifkeywas renamed tonewkey.falseifnewkeyalready exists.
-
scan
KeyScanCursor<K> scan()
Execute the command SCAN. Summary: Incrementally iterate the keys space Group: generic Requires Redis 2.8.0- Returns:
- the cursor.
-
scan
KeyScanCursor<K> scan(KeyScanArgs args)
Execute the command SCAN. Summary: Incrementally iterate the keys space Group: generic Requires Redis 2.8.0- Parameters:
args- the extra arguments- Returns:
- the cursor.
-
touch
int touch(K... keys)
Execute the command TOUCH. Summary: Alters the last access time of a key(s). Returns the number of existing keys specified. Group: generic Requires Redis 3.2.1- Parameters:
keys- the keys- Returns:
- The number of keys that were touched.
-
ttl
long ttl(K key) throws RedisKeyNotFoundException
Execute the command TTL. Summary: Get the time to live for a key in seconds Group: generic Requires Redis 1.0.0- Parameters:
key- the key- Returns:
- TTL in seconds,
-1if the key exists but has no associated expire. - Throws:
RedisKeyNotFoundException- if the key does not exist
-
type
RedisValueType type(K key)
Execute the command TYPE. Summary: Determine the type stored at key Group: generic Requires Redis 1.0.0- Parameters:
key- the key- Returns:
- type of key, or
NONEwhen key does not exist.
-
-