Skip to content

Commit

Permalink
Small fixes in the docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
mzimbres committed Oct 7, 2023
1 parent 11c9c1b commit 66b632b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -92,14 +91,17 @@ receiver(std::shared_ptr<connection> conn) -> net::awaitable<void>
request req;
req.push("SUBSCRIBE", "channel");
generic_response resp;
conn->set_receive_response(resp);
// Loop while reconnection is enabled
while (conn->will_reconnect()) {
// Reconnect to channels.
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)
Expand All @@ -108,7 +110,7 @@ receiver(std::shared_ptr<connection> conn) -> net::awaitable<void>
// Use the response resp in some way and then clear it.
...
resp.value().clear();
consume_one(resp);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions meta/libraries.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"key": "redis",
"name": "Redis",
"authors": [
"Marcelo Zimbres"
"Marcelo Zimbres Silva"
],
"description": "Redis async client library built on top of Boost.Asio.",
"category": [
"Concurrent",
"IO"
],
"maintainers": [
"Marcelo Zimbres <[email protected]>"
"Marcelo Zimbres Silva <[email protected]>"
],
"cxxstd": "17"
}
}

0 comments on commit 66b632b

Please sign in to comment.