Async Redis client using the lev event loop.
Must be called within lev.run().
| Module | Description |
|---|---|
| redis.resp | Shared RESP2 protocol encoding/decoding and Redis connection config validation. |
| Name | Signature |
|---|---|
client:cmd | client:cmd(...) -> result, err |
client:pipeline | client:pipeline(commands) -> results, err |
client:read | client:read() -> response, err |
client:close | client:close(no_keepalive) -> ok |
connect | connect(config) -> client, err |
client:cmd(
...) ->result,err
Execute a Redis command and return the parsed response
client:pipeline(
commands) ->results,err
Execute multiple Redis commands in a single round-trip (pipelining)
Sends all commands at once and reads all responses. Each entry in
commands is an array of arguments (same as cmd varargs).
Returns an array of result tables { value, err } in the same order.
client:read() ->
response,err
Read a raw RESP response from the connection
client:close(
no_keepalive) ->ok
Close the Redis connection
Closes the connection. By default the underlying socket is returned
to the connection pool for reuse. Pass true to force-close the
socket instead of pooling it. The socket is also force-closed when
the pool exceeds its size limit.
connect(
config) ->client,err
Connect to a Redis server asynchronously
Establishes an async connection to a Redis server, returning a client
object. Must be called within lev.run().
config, when provided, can be either a string URL, or a table.