2
0
mirror of https://github.com/boostorg/redis.git synced 2026-02-22 03:32:22 +00:00

More improvements in the examples.

This commit is contained in:
Marcelo Zimbres
2021-11-13 16:35:16 +01:00
parent 381cc0b4f3
commit 0dda663dbe
5 changed files with 76 additions and 47 deletions

View File

@@ -13,7 +13,12 @@
#include "types.hpp"
#include "utils.ipp"
using namespace aedis;
using aedis::command;
using aedis::resp3::request;
using aedis::resp3::response;
using aedis::resp3::async_read;
namespace net = aedis::net;
/** A simple example that illustrates the basic principles. Three commands are
* sent in the same request
@@ -28,7 +33,7 @@ using namespace aedis;
net::awaitable<void> ping()
{
try {
resp3::request req;
request req;
req.push(command::hello, 3);
req.push(command::ping);
req.push(command::quit);
@@ -37,7 +42,7 @@ net::awaitable<void> ping()
co_await async_write(socket, req);
std::string buffer;
resp3::response resp;
response resp;
// hello
co_await async_read(socket, buffer, resp);