Changes for version 0.001007 - 2026-04-21
- Feature: Callback-driven Subscription delivery
- New on_message($cb) and on_error($cb) setters on Async::Redis::Subscription, alongside the existing on_reconnect($cb)
- Callback signature is ($sub, $msg) / ($sub, $err), consistent with on_reconnect
- Message hashref shape matches next(): type, channel, pattern (always present, undef for non-pmessage), data
- Synchronous by default; return a Future from the callback for opt-in backpressure (driver awaits it before reading the next frame; failed Futures route to on_error)
- Once on_message is set, next() croaks — sticky callback mode for the lifetime of the subscription
- Default on_error behavior is to die loudly to prevent silent zombie subscriptions; register an explicit no-op to swallow
- Designed for fire-and-forget listeners (channel-layer middleware, websocket gateways, background dispatchers) that trigger Future::AsyncAwait "lost its returning future" warnings with the iterator pattern
- Behavior change: Async::Redis::disconnect now calls _close on any active Subscription before closing the socket, so the subscription's driver doesn't trip over an EOF on its pending read. Additive — existing iterator-mode callers are unaffected
- Internal: factored _dispatch_frame and _read_frame_with_reconnect out of Subscription::next; shared between the iterator and callback paths. Reconnect semantics are identical across both
- Pattern subscription responses now include pattern => undef on non-pmessage frames (previously omitted); no exists() check needed
Modules
Async Redis client using Future::IO
Automatic command batching
Auto-generated Redis command methods
Base exception class for Redis errors
Connection failure exception
Disconnected exception
Protocol violation exception
Redis server error exception
Timeout exception
Cursor-based SCAN iterator
Key position detection for Redis commands
Command pipelining
Connection pool for Async::Redis
Reusable Lua script wrapper with EVALSHA optimization
PubSub subscription handler
Observability for Redis client
Transaction command collector
Redis connection URI parser
Examples
- examples/README.md
- examples/docker-compose.yml
- examples/pagi-chat/README.md
- examples/pagi-chat/app.pl
- examples/pagi-chat/lib/ChatApp/HTTP.pm
- examples/pagi-chat/public/css/style.css
- examples/pagi-chat/public/index.html
- examples/pagi-chat/public/js/app.js
- examples/pagi-chat/reset-redis.sh
- examples/slow-redis/README.md
- examples/slow-redis/app.pl