Class BlockingKeyCommandsImpl<K>
- java.lang.Object
-
- io.quarkus.redis.runtime.datasource.BlockingKeyCommandsImpl<K>
-
- All Implemented Interfaces:
KeyCommands<K>
public class BlockingKeyCommandsImpl<K> extends Object implements KeyCommands<K>
-
-
Constructor Summary
Constructors Constructor Description BlockingKeyCommandsImpl(ReactiveKeyCommands<K> reactive, Duration timeout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
copy(K source, K destination)
Execute the command COPY.boolean
copy(K source, K destination, CopyArgs copyArgs)
Execute the command COPY.int
del(K... keys)
Execute the command DEL.String
dump(K key)
Execute the command DUMP.boolean
exists(K key)
Execute the command EXISTS.int
exists(K... keys)
Execute the command EXISTS.boolean
expire(K key, long seconds)
Execute the command EXPIRE.boolean
expire(K key, long seconds, ExpireArgs expireArgs)
Execute the command EXPIRE.boolean
expire(K key, Duration duration)
Execute the command EXPIRE.boolean
expire(K key, Duration duration, ExpireArgs expireArgs)
Execute the command EXPIRE.boolean
expireat(K key, long timestamp)
Execute the command EXPIREAT.boolean
expireat(K key, long timestamp, ExpireArgs expireArgs)
Execute the command EXPIREAT.boolean
expireat(K key, Instant timestamp)
Execute the command EXPIREAT.boolean
expireat(K key, Instant timestamp, ExpireArgs expireArgs)
Execute the command EXPIREAT.long
expiretime(K key)
Execute the command EXPIRETIME.List<K>
keys(String pattern)
Execute the command KEYS.boolean
move(K key, long db)
Execute the command MOVE.boolean
persist(K key)
Execute the command PERSIST.boolean
pexpire(K key, long ms)
Execute the command PEXPIRE.boolean
pexpire(K key, long seconds, ExpireArgs pexpireArgs)
Execute the command PEXPIRE.boolean
pexpire(K key, Duration duration)
Execute the command PEXPIRE.boolean
pexpire(K key, Duration duration, ExpireArgs pexpireArgs)
Execute the command PEXPIRE.boolean
pexpireat(K key, long timestamp)
Execute the command PEXPIREAT.boolean
pexpireat(K key, long timestamp, ExpireArgs pexpireArgs)
Execute the command PEXPIREAT.boolean
pexpireat(K key, Instant timestamp)
Execute the command PEXPIREAT.boolean
pexpireat(K key, Instant timestamp, ExpireArgs pexpireArgs)
Execute the command PEXPIREAT.long
pexpiretime(K key)
Execute the command PEXPIRETIME.long
pttl(K key)
Execute the command PTTL.K
randomkey()
Execute the command RANDOMKEY.void
rename(K key, K newkey)
Execute the command RENAME.boolean
renamenx(K key, K newkey)
Execute the command RENAMENX.KeyScanCursor<K>
scan()
Execute the command SCAN.KeyScanCursor<K>
scan(KeyScanArgs args)
Execute the command SCAN.int
touch(K... keys)
Execute the command TOUCH.long
ttl(K key)
Execute the command TTL.RedisValueType
type(K key)
Execute the command TYPE.int
unlink(K... keys)
Execute the command UNLINK.
-
-
-
Constructor Detail
-
BlockingKeyCommandsImpl
public BlockingKeyCommandsImpl(ReactiveKeyCommands<K> reactive, Duration timeout)
-
-
Method Detail
-
copy
public boolean copy(K source, K destination)
Description copied from interface:KeyCommands
Execute the command COPY. Summary: Copy a key Group: generic Requires Redis 6.2.0- Specified by:
copy
in interfaceKeyCommands<K>
- Parameters:
source
- the keydestination
- the key- Returns:
true
source was copied.false
source was not copied.
-
copy
public boolean copy(K source, K destination, CopyArgs copyArgs)
Description copied from interface:KeyCommands
Execute the command COPY. Summary: Copy a key Group: generic Requires Redis 6.2.0- Specified by:
copy
in interfaceKeyCommands<K>
- Parameters:
source
- the keydestination
- the keycopyArgs
- the additional arguments- Returns:
true
source was copied.false
source was not copied.
-
del
public int del(K... keys)
Description copied from interface:KeyCommands
Execute the command DEL. Summary: Delete one or multiple keys Group: generic Requires Redis 1.0.0- Specified by:
del
in interfaceKeyCommands<K>
- Parameters:
keys
- the keys.- Returns:
- The number of keys that were removed.
-
dump
public String dump(K key)
Description copied from interface:KeyCommands
Execute the command DUMP. Summary: Return a serialized version of the value stored at the specified key. Group: generic Requires Redis 2.6.0- Specified by:
dump
in interfaceKeyCommands<K>
- Parameters:
key
- the key- Returns:
- the serialized value.
-
exists
public boolean exists(K key)
Description copied from interface:KeyCommands
Execute the command EXISTS. Summary: Determine if a key exists Group: generic Requires Redis 1.0.0- Specified by:
exists
in interfaceKeyCommands<K>
- Parameters:
key
- the key to check- Returns:
true
if the key exists,false
otherwise
-
exists
public int exists(K... keys)
Description copied from interface:KeyCommands
Execute the command EXISTS. Summary: Determine if a key exists Group: generic Requires Redis 1.0.0- Specified by:
exists
in interfaceKeyCommands<K>
- Parameters:
keys
- the keys to check- Returns:
- the number of keys that exist from those specified as arguments.
-
expire
public boolean expire(K key, long seconds, ExpireArgs expireArgs)
Description copied from interface:KeyCommands
Execute the command EXPIRE. Summary: Set a key's time to live in seconds Group: generic Requires Redis 1.0.0- Specified by:
expire
in interfaceKeyCommands<K>
- Parameters:
key
- the keyseconds
- the new TTLexpireArgs
- theEXPIRE
command extra-arguments- Returns:
true
the timeout was set.false
the timeout was not set. e.g. key doesn't exist, or operation skipped due to the provided arguments.
-
expire
public boolean expire(K key, Duration duration, ExpireArgs expireArgs)
Description copied from interface:KeyCommands
Execute the command EXPIRE. Summary: Set a key's time to live in seconds Group: generic Requires Redis 1.0.0- Specified by:
expire
in interfaceKeyCommands<K>
- Parameters:
key
- the keyduration
- the new TTLexpireArgs
- theEXPIRE
command extra-arguments- Returns:
true
the timeout was set.false
the timeout was not set. e.g. key doesn't exist, or operation skipped due to the provided arguments.
-
expire
public boolean expire(K key, long seconds)
Description copied from interface:KeyCommands
Execute the command EXPIRE. Summary: Set a key's time to live in seconds Group: generic Requires Redis 1.0.0- Specified by:
expire
in interfaceKeyCommands<K>
- Parameters:
key
- the keyseconds
- the new TTL- Returns:
true
the timeout was set.false
the timeout was not set. e.g. key doesn't exist.
-
expire
public boolean expire(K key, Duration duration)
Description copied from interface:KeyCommands
Execute the command EXPIRE. Summary: Set a key's time to live in seconds Group: generic Requires Redis 1.0.0- Specified by:
expire
in interfaceKeyCommands<K>
- Parameters:
key
- the keyduration
- the new TTL- Returns:
true
the timeout was set.false
the timeout was not set. e.g. key doesn't exist.
-
expireat
public boolean expireat(K key, long timestamp)
Description copied from interface:KeyCommands
Execute the command EXPIREAT. Summary: Set the expiration for a key as a UNIX timestamp Group: generic Requires Redis 1.2.0- Specified by:
expireat
in interfaceKeyCommands<K>
- Parameters:
key
- the keytimestamp
- the timestamp- Returns:
true
the timeout was set.false
the timeout was not set. e.g. key doesn't exist.
-
expireat
public boolean expireat(K key, Instant timestamp)
Description copied from interface:KeyCommands
Execute the command EXPIREAT. Summary: Set the expiration for a key as a UNIX timestamp Group: generic Requires Redis 1.2.0- Specified by:
expireat
in interfaceKeyCommands<K>
- Parameters:
key
- the keytimestamp
- the timestamp- Returns:
true
the timeout was set.false
the timeout was not set. e.g. key doesn't exist.
-
expireat
public boolean expireat(K key, long timestamp, ExpireArgs expireArgs)
Description copied from interface:KeyCommands
Execute the command EXPIREAT. Summary: Set the expiration for a key as a UNIX timestamp Group: generic Requires Redis 1.2.0- Specified by:
expireat
in interfaceKeyCommands<K>
- Parameters:
key
- the keytimestamp
- the timestampexpireArgs
- theEXPIREAT
command extra-arguments- Returns:
true
the timeout was set.false
the timeout was not set. e.g. key doesn't exist, or operation skipped due to the provided arguments.
-
expireat
public boolean expireat(K key, Instant timestamp, ExpireArgs expireArgs)
Description copied from interface:KeyCommands
Execute the command EXPIREAT. Summary: Set the expiration for a key as a UNIX timestamp Group: generic Requires Redis 1.2.0- Specified by:
expireat
in interfaceKeyCommands<K>
- Parameters:
key
- the keytimestamp
- the timestampexpireArgs
- theEXPIREAT
command extra-arguments- Returns:
true
the timeout was set.false
the timeout was not set. e.g. key doesn't exist, or operation skipped due to the provided arguments.
-
expiretime
public long expiretime(K key)
Description copied from interface:KeyCommands
Execute the command EXPIRETIME. Summary: Get the expiration Unix timestamp for a key Group: generic Requires Redis 7.0.0- Specified by:
expiretime
in interfaceKeyCommands<K>
- Parameters:
key
- the key- Returns:
- the expiration Unix timestamp in seconds,
-1
if the key exists but has no associated expiration time.
-
keys
public List<K> keys(String pattern)
Description copied from interface:KeyCommands
Execute the command KEYS. Summary: Find all keys matching the given pattern Group: generic Requires Redis 1.0.0- Specified by:
keys
in interfaceKeyCommands<K>
- Parameters:
pattern
- the glob-style pattern- Returns:
- the list of keys matching pattern.
-
move
public boolean move(K key, long db)
Description copied from interface:KeyCommands
Execute the command MOVE. Summary: Move a key to another database Group: generic Requires Redis 1.0.0- Specified by:
move
in interfaceKeyCommands<K>
- Parameters:
key
- the key- Returns:
true
key was moved.false
key was not moved.
-
persist
public boolean persist(K key)
Description copied from interface:KeyCommands
Execute the command PERSIST. Summary: Remove the expiration from a key Group: generic Requires Redis 2.2.0- Specified by:
persist
in interfaceKeyCommands<K>
- Parameters:
key
- the key- Returns:
true
the timeout was removed.false
key does not exist or does not have an associated timeout.
-
pexpire
public boolean pexpire(K key, long seconds, ExpireArgs pexpireArgs)
Description copied from interface:KeyCommands
Execute the command PEXPIRE. Summary: Set a key's time to live in milliseconds Group: generic Requires Redis 2.6.0- Specified by:
pexpire
in interfaceKeyCommands<K>
- Parameters:
key
- the keyseconds
- the new TTLpexpireArgs
- thePEXPIRE
command extra-arguments- Returns:
true
the timeout was set.false
the timeout was not set. e.g. key doesn't exist.
-
pexpire
public boolean pexpire(K key, Duration duration, ExpireArgs pexpireArgs)
Description copied from interface:KeyCommands
Execute the command PEXPIRE. Summary: Set a key's time to live in milliseconds Group: generic Requires Redis 2.6.0- Specified by:
pexpire
in interfaceKeyCommands<K>
- Parameters:
key
- the keyduration
- the new TTLpexpireArgs
- thePEXPIRE
command extra-arguments- Returns:
true
the timeout was set.false
the timeout was not set. e.g. key doesn't exist, or operation skipped due to the provided arguments.
-
pexpire
public boolean pexpire(K key, long ms)
Description copied from interface:KeyCommands
Execute the command PEXPIRE. Summary: Set a key's time to live in milliseconds Group: generic Requires Redis 2.6.0- Specified by:
pexpire
in interfaceKeyCommands<K>
- Parameters:
key
- the keyms
- the new TTL- Returns:
true
the timeout was set.false
the timeout was not set. e.g. key doesn't exist.
-
pexpire
public boolean pexpire(K key, Duration duration)
Description copied from interface:KeyCommands
Execute the command PEXPIRE. Summary: Set a key's time to live in milliseconds Group: generic Requires Redis 2.6.0- Specified by:
pexpire
in interfaceKeyCommands<K>
- Parameters:
key
- the keyduration
- the new TTL- Returns:
true
the timeout was set.false
the timeout was not set. e.g. key doesn't exist.
-
pexpireat
public boolean pexpireat(K key, long timestamp)
Description copied from interface:KeyCommands
Execute the command PEXPIREAT. Summary: Set the expiration for a key as a UNIX timestamp Group: generic Requires Redis 2.6.0- Specified by:
pexpireat
in interfaceKeyCommands<K>
- Parameters:
key
- the keytimestamp
- the timestamp- Returns:
true
the timeout was set.false
the timeout was not set. e.g. key doesn't exist.
-
pexpireat
public boolean pexpireat(K key, Instant timestamp)
Description copied from interface:KeyCommands
Execute the command PEXPIREAT. Summary: Set the expiration for a key as a UNIX timestamp Group: generic Requires Redis 2.6.0- Specified by:
pexpireat
in interfaceKeyCommands<K>
- Parameters:
key
- the keytimestamp
- the timestamp- Returns:
true
the timeout was set.false
the timeout was not set. e.g. key doesn't exist.
-
pexpireat
public boolean pexpireat(K key, long timestamp, ExpireArgs pexpireArgs)
Description copied from interface:KeyCommands
Execute the command PEXPIREAT. Summary: Set the expiration for a key as a UNIX timestamp Group: generic Requires Redis 2.6.0- Specified by:
pexpireat
in interfaceKeyCommands<K>
- Parameters:
key
- the keytimestamp
- the timestamppexpireArgs
- theEXPIREAT
command extra-arguments- Returns:
true
the timeout was set.false
the timeout was not set. e.g. key doesn't exist, or operation skipped due to the provided arguments.
-
pexpireat
public boolean pexpireat(K key, Instant timestamp, ExpireArgs pexpireArgs)
Description copied from interface:KeyCommands
Execute the command PEXPIREAT. Summary: Set the expiration for a key as a UNIX timestamp Group: generic Requires Redis 2.6.0- Specified by:
pexpireat
in interfaceKeyCommands<K>
- Parameters:
key
- the keytimestamp
- the timestamppexpireArgs
- theEXPIREAT
command extra-arguments- Returns:
true
the timeout was set.false
the timeout was not set. e.g. key doesn't exist, or operation skipped due to the provided arguments.
-
pexpiretime
public long pexpiretime(K key)
Description copied from interface:KeyCommands
Execute the command PEXPIRETIME. Summary: Get the expiration Unix timestamp for a key Group: generic Requires Redis 2.6.0- Specified by:
pexpiretime
in interfaceKeyCommands<K>
- Parameters:
key
- the key- Returns:
- the expiration Unix timestamp in milliseconds;
-1
if the key exists but has no associated expiration time.
-
pttl
public long pttl(K key)
Description copied from interface:KeyCommands
Execute the command PTTL. Summary: Get the time to live for a key in milliseconds Group: generic Requires Redis 2.6.0- Specified by:
pttl
in interfaceKeyCommands<K>
- Parameters:
key
- the key- Returns:
- TTL in milliseconds. The command returns
-1
if the key exists but has no associated expire.
-
randomkey
public K randomkey()
Description copied from interface:KeyCommands
Execute the command RANDOMKEY. Summary: Return a random key from the keyspace Group: generic Requires Redis 1.0.0- Specified by:
randomkey
in interfaceKeyCommands<K>
- Returns:
- the random key, or
null
when the database is empty.
-
rename
public void rename(K key, K newkey)
Description copied from interface:KeyCommands
Execute the command RENAME. Summary: Rename a key Group: generic Requires Redis 1.0.0- Specified by:
rename
in interfaceKeyCommands<K>
- Parameters:
key
- the keynewkey
- the new key
-
renamenx
public boolean renamenx(K key, K newkey)
Description copied from interface:KeyCommands
Execute the command RENAMENX. Summary: Rename a key, only if the new key does not exist Group: generic Requires Redis 1.0.0- Specified by:
renamenx
in interfaceKeyCommands<K>
- Parameters:
key
- the keynewkey
- the new key- Returns:
true
ifkey
was renamed tonewkey
.false
ifnewkey
already exists.
-
scan
public KeyScanCursor<K> scan()
Description copied from interface:KeyCommands
Execute the command SCAN. Summary: Incrementally iterate the keys space Group: generic Requires Redis 2.8.0- Specified by:
scan
in interfaceKeyCommands<K>
- Returns:
- the cursor.
-
scan
public KeyScanCursor<K> scan(KeyScanArgs args)
Description copied from interface:KeyCommands
Execute the command SCAN. Summary: Incrementally iterate the keys space Group: generic Requires Redis 2.8.0- Specified by:
scan
in interfaceKeyCommands<K>
- Parameters:
args
- the extra arguments- Returns:
- the cursor.
-
touch
public int touch(K... keys)
Description copied from interface:KeyCommands
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- Specified by:
touch
in interfaceKeyCommands<K>
- Parameters:
keys
- the keys- Returns:
- The number of keys that were touched.
-
ttl
public long ttl(K key)
Description copied from interface:KeyCommands
Execute the command TTL. Summary: Get the time to live for a key in seconds Group: generic Requires Redis 1.0.0- Specified by:
ttl
in interfaceKeyCommands<K>
- Parameters:
key
- the key- Returns:
- TTL in seconds,
-1
if the key exists but has no associated expire.
-
type
public RedisValueType type(K key)
Description copied from interface:KeyCommands
Execute the command TYPE. Summary: Determine the type stored at key Group: generic Requires Redis 1.0.0- Specified by:
type
in interfaceKeyCommands<K>
- Parameters:
key
- the key- Returns:
- type of key, or
NONE
when key does not exist.
-
unlink
public int unlink(K... keys)
Description copied from interface:KeyCommands
Execute the command UNLINK. Summary: Delete a key asynchronously in another thread. Otherwise, it is just asDEL
, but non-blocking. Group: generic Requires Redis 4.0.0- Specified by:
unlink
in interfaceKeyCommands<K>
- Parameters:
keys
- the keys- Returns:
- The number of keys that were unlinked.
-
-