diff --git a/README.md b/README.md index 48f73a25..16c4a7b5 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,9 @@ Boost.Redis is a high-level [Redis](https://redis.io/) client library built on top of [Boost.Asio](https://www.boost.org/doc/libs/release/doc/html/boost_asio.html) -that implements Redis plain text protocol +that implements the Redis protocol [RESP3](https://github.com/redis/redis-specifications/blob/master/protocol/RESP3.md). -It can multiplex any number of client -requests, responses, and server pushes onto a single active socket -connection to the Redis server. The requirements for using Boost.Redis are: +The requirements for using Boost.Redis are: * Boost. The library is included in Boost distributions starting with 1.84. * C++17 or higher. @@ -82,8 +80,9 @@ them are * [Client-side caching](https://redis.io/docs/manual/client-side-caching/) The connection class supports server pushes by means of the -`boost::redis::connection::async_receive` function, the coroutine shows how -to used it +`boost::redis::connection::async_receive` function, which can be +called in the same connection that is being used to execute commands. +The coroutine below shows how to used it ```cpp auto @@ -92,6 +91,9 @@ receiver(std::shared_ptr conn) -> net::awaitable request req; req.push("SUBSCRIBE", "channel"); + generic_response resp; + conn->set_receive_response(resp); + // Loop while reconnection is enabled while (conn->will_reconnect()) { @@ -99,7 +101,7 @@ receiver(std::shared_ptr conn) -> net::awaitable co_await conn->async_exec(req, ignore, net::deferred); // Loop reading Redis pushes. - for (generic_response resp;;) { + for (;;) { error_code ec; co_await conn->async_receive(resp, net::redirect_error(net::use_awaitable, ec)); if (ec) @@ -108,7 +110,7 @@ receiver(std::shared_ptr conn) -> net::awaitable // Use the response resp in some way and then clear it. ... - resp.value().clear(); + consume_one(resp); } } } diff --git a/meta/libraries.json b/meta/libraries.json index 242df684..3b1fe392 100644 --- a/meta/libraries.json +++ b/meta/libraries.json @@ -2,7 +2,7 @@ "key": "redis", "name": "Redis", "authors": [ - "Marcelo Zimbres" + "Marcelo Zimbres Silva" ], "description": "Redis async client library built on top of Boost.Asio.", "category": [ @@ -10,7 +10,7 @@ "IO" ], "maintainers": [ - "Marcelo Zimbres " + "Marcelo Zimbres Silva " ], "cxxstd": "17" -} \ No newline at end of file +}