Async-Redis

 view release on metacpan or  search on metacpan

examples/slow-redis/README.md  view on Meta::CPAN

### 5 concurrent requests (should be ~1 second, not 5!)
```bash
time (for i in 1 2 3 4 5; do curl -s http://localhost:5001/ & done; wait)
```

### 10 concurrent requests
```bash
time (for i in $(seq 1 10); do curl -s http://localhost:5001/ & done; wait)
```

### Compare with fast endpoint (no delay)
```bash
curl http://localhost:5001/fast
```

## Expected Output

```
Slow Redis Response
===================
Worker PID:     12345

examples/slow-redis/app.pl  view on Meta::CPAN


    # Run the server
    REDIS_HOST=localhost pagi-server --app examples/slow-redis/app.pl --port 5001

    # Test single request (takes ~1 second)
    curl http://localhost:5001/

    # Test 5 concurrent requests (should still take ~1 second total!)
    time (for i in 1 2 3 4 5; do curl -s http://localhost:5001/ & done; wait)

    # Compare with fast endpoint (no delay)
    curl http://localhost:5001/fast

=head1 DESCRIPTION

This example demonstrates non-blocking I/O by intentionally sleeping for
1 second before returning a response. Despite the delay, the server can
handle many concurrent requests because the sleep is non-blocking.

With traditional blocking I/O:
- 5 sequential requests = 5 seconds

lib/Async/Redis/Cookbook.pod  view on Meta::CPAN


=head1 SYNOPSIS

This cookbook shows small, copyable Async::Redis patterns. The examples are
written for use inside an C<async sub>:

=over 4

=item * C<$redis> is a connected L<Async::Redis> client.

=item * C<$host> and C<$port> are the Redis endpoint.

=item * C<$prefix> is a unique key prefix for the example.

=item * C<Future>, C<Future::AsyncAwait>, C<Future::IO>, C<Async::Redis>, and
C<Async::Redis::Pool> are loaded where needed.

=back

The C<die> checks are intentional. They keep the cookbook examples executable
by C<t/00-pod/cookbook-examples.t> so the documentation does not drift away



( run in 0.858 second using v1.01-cache-2.11-cpan-524268b4103 )