NAME
Async::Redis::AutoPipeline - Automatic command batching
DESCRIPTION
AutoPipeline transparently batches Redis commands issued in the same event loop tick into a single pipeline, reducing network round-trips without changing the caller's API.
How It Works
# These three commands are batched automatically
my $f1 = $redis->set('a', 1);
my $f2 = $redis->set('b', 2);
my $f3 = $redis->get('a');
await Future->needs_all($f1, $f2, $f3);
When auto_pipeline => 1:
1. Commands queue locally instead of sending immediately 2. A "next tick" callback is scheduled 3. When event loop yields, all queued commands flush as pipeline 4. Responses distributed to original futures
Invariants
_flush_pendingprevents double-scheduling_flushingguard prevents reentrancyDepth limit triggers multiple batches if exceeded
Future::IO->lateris non-blocking next-tick