Class PipelineExecutor
java.lang.Object
com.github.darksoulq.abyssallib.common.database.nosql.redis.PipelineExecutor
A fluent builder for executing multiple Redis commands in a single batch (Pipelining).
Pipelining significantly improves performance by sending multiple commands to the server without waiting for individual replies.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionQueues a DEL command for one or more keys.voidexecute()Executes all queued operations synchronously.Executes all queued operations asynchronously using the database thread pool.Queues an EXPIRE command.Queues a Hash DEL command.Queues a Hash SET command for a single field.Queues a Hash SET command for multiple fields.Queues a List Left Push command.Queues a List Right Push command.Queues a Set Add command.Queues a SET command.Queues a SETEX (Set with Expiry) command.Queues a Set Remove command.
-
Constructor Details
-
PipelineExecutor
-
-
Method Details
-
set
Queues a SET command.- Parameters:
key- The key.value- The value.- Returns:
- This executor instance.
-
setex
Queues a SETEX (Set with Expiry) command.- Parameters:
key- The key.seconds- Expiration in seconds.value- The value.- Returns:
- This executor instance.
-
del
Queues a DEL command for one or more keys.- Parameters:
keys- The keys to delete.- Returns:
- This executor instance.
-
hset
Queues a Hash SET command for a single field.- Parameters:
key- The hash key.field- The field name.value- The field value.- Returns:
- This executor instance.
-
hset
Queues a Hash SET command for multiple fields.- Parameters:
key- The hash key.hash- A map of fields and values.- Returns:
- This executor instance.
-
hdel
Queues a Hash DEL command.- Parameters:
key- The hash key.fields- The fields to remove.- Returns:
- This executor instance.
-
lpush
Queues a List Left Push command.- Parameters:
key- The list key.values- The values to push.- Returns:
- This executor instance.
-
rpush
Queues a List Right Push command.- Parameters:
key- The list key.values- The values to push.- Returns:
- This executor instance.
-
sadd
Queues a Set Add command.- Parameters:
key- The set key.members- The members to add.- Returns:
- This executor instance.
-
srem
Queues a Set Remove command.- Parameters:
key- The set key.members- The members to remove.- Returns:
- This executor instance.
-
expire
Queues an EXPIRE command.- Parameters:
key- The key.seconds- Time to live in seconds.- Returns:
- This executor instance.
-
execute
public void execute()Executes all queued operations synchronously. -
executeAsync
Executes all queued operations asynchronously using the database thread pool.- Returns:
- A
CompletableFuturerepresenting the pending execution.
-