mirror of
https://github.com/boostorg/redis.git
synced 2026-01-19 04:42:09 +00:00
Small fixes in the docs.
This commit is contained in:
18
README.md
18
README.md
@@ -2,11 +2,9 @@
|
|||||||
|
|
||||||
Boost.Redis is a high-level [Redis](https://redis.io/) client library built on top of
|
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)
|
[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).
|
[RESP3](https://github.com/redis/redis-specifications/blob/master/protocol/RESP3.md).
|
||||||
It can multiplex any number of client
|
The requirements for using Boost.Redis are:
|
||||||
requests, responses, and server pushes onto a single active socket
|
|
||||||
connection to the Redis server. The requirements for using Boost.Redis are:
|
|
||||||
|
|
||||||
* Boost. The library is included in Boost distributions starting with 1.84.
|
* Boost. The library is included in Boost distributions starting with 1.84.
|
||||||
* C++17 or higher.
|
* C++17 or higher.
|
||||||
@@ -82,8 +80,9 @@ them are
|
|||||||
* [Client-side caching](https://redis.io/docs/manual/client-side-caching/)
|
* [Client-side caching](https://redis.io/docs/manual/client-side-caching/)
|
||||||
|
|
||||||
The connection class supports server pushes by means of the
|
The connection class supports server pushes by means of the
|
||||||
`boost::redis::connection::async_receive` function, the coroutine shows how
|
`boost::redis::connection::async_receive` function, which can be
|
||||||
to used it
|
called in the same connection that is being used to execute commands.
|
||||||
|
The coroutine below shows how to used it
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
auto
|
auto
|
||||||
@@ -92,6 +91,9 @@ receiver(std::shared_ptr<connection> conn) -> net::awaitable<void>
|
|||||||
request req;
|
request req;
|
||||||
req.push("SUBSCRIBE", "channel");
|
req.push("SUBSCRIBE", "channel");
|
||||||
|
|
||||||
|
generic_response resp;
|
||||||
|
conn->set_receive_response(resp);
|
||||||
|
|
||||||
// Loop while reconnection is enabled
|
// Loop while reconnection is enabled
|
||||||
while (conn->will_reconnect()) {
|
while (conn->will_reconnect()) {
|
||||||
|
|
||||||
@@ -99,7 +101,7 @@ receiver(std::shared_ptr<connection> conn) -> net::awaitable<void>
|
|||||||
co_await conn->async_exec(req, ignore, net::deferred);
|
co_await conn->async_exec(req, ignore, net::deferred);
|
||||||
|
|
||||||
// Loop reading Redis pushes.
|
// Loop reading Redis pushes.
|
||||||
for (generic_response resp;;) {
|
for (;;) {
|
||||||
error_code ec;
|
error_code ec;
|
||||||
co_await conn->async_receive(resp, net::redirect_error(net::use_awaitable, ec));
|
co_await conn->async_receive(resp, net::redirect_error(net::use_awaitable, ec));
|
||||||
if (ec)
|
if (ec)
|
||||||
@@ -108,7 +110,7 @@ receiver(std::shared_ptr<connection> conn) -> net::awaitable<void>
|
|||||||
// Use the response resp in some way and then clear it.
|
// Use the response resp in some way and then clear it.
|
||||||
...
|
...
|
||||||
|
|
||||||
resp.value().clear();
|
consume_one(resp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"key": "redis",
|
"key": "redis",
|
||||||
"name": "Redis",
|
"name": "Redis",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Marcelo Zimbres"
|
"Marcelo Zimbres Silva"
|
||||||
],
|
],
|
||||||
"description": "Redis async client library built on top of Boost.Asio.",
|
"description": "Redis async client library built on top of Boost.Asio.",
|
||||||
"category": [
|
"category": [
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
"IO"
|
"IO"
|
||||||
],
|
],
|
||||||
"maintainers": [
|
"maintainers": [
|
||||||
"Marcelo Zimbres <mzimbres@gmail.com>"
|
"Marcelo Zimbres Silva <mzimbres@gmail.com>"
|
||||||
],
|
],
|
||||||
"cxxstd": "17"
|
"cxxstd": "17"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user