Class QueryExecutor
java.lang.Object
com.github.darksoulq.abyssallib.common.database.nosql.redis.QueryExecutor
Provides a high-level API for executing standard Redis commands.
This class handles resource management (try-with-resources) for every call and provides both synchronous and asynchronous variants of common commands.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDeletes one or more keys.Deletes keys asynchronously.booleanChecks if a key exists in the database.voidSets a timeout on a key.Retrieves the value of a key.Gets a key value asynchronously.voidDeletes fields from a hash.Gets a field value from a hash.Retrieves all fields and values from a hash.hgetAllAsync(String key) Gets all fields from a hash asynchronously.Gets a hash field value asynchronously.voidSets a field in a Redis hash.voidSets multiple fields in a Redis hash using a map.Sets a hash field asynchronously.voidPushes values to the front (left) of a list.Retrieves a range of elements from a list.pipeline()Creates a new PipelineExecutor for batching operations starting from this executor.voidPushes values to the end (right) of a list.voidAdds members to a set.voidSets a key to a specific value.Sets a key value asynchronously.voidSets a key with an expiration time.booleanChecks if a value is a member of a set.Retrieves all members of a set.
-
Constructor Details
-
QueryExecutor
-
-
Method Details
-
set
-
setex
-
get
-
del
-
hset
-
hset
-
hget
-
hgetAll
-
hdel
-
lpush
-
rpush
-
lrange
-
sadd
-
smembers
-
sismember
-
exists
Checks if a key exists in the database.- Parameters:
key- The key to check.- Returns:
- True if it exists.
-
expire
Sets a timeout on a key.- Parameters:
key- The key.seconds- Timeout in seconds.
-
setAsync
Sets a key value asynchronously.- Returns:
- A future.
-
getAsync
Gets a key value asynchronously.- Returns:
- A future containing the string.
-
hsetAsync
Sets a hash field asynchronously.- Returns:
- A future.
-
hgetAsync
Gets a hash field value asynchronously.- Returns:
- A future containing the string.
-
hgetAllAsync
Gets all fields from a hash asynchronously.- Returns:
- A future containing the map.
-
delAsync
Deletes keys asynchronously.- Returns:
- A future.
-
pipeline
Creates a new PipelineExecutor for batching operations starting from this executor.- Returns:
- A new
PipelineExecutor.
-