mirror of
https://github.com/boostorg/redis.git
synced 2026-01-19 04:42:09 +00:00
38 lines
808 B
C++
38 lines
808 B
C++
/* Copyright (c) 2018-2022 Marcelo Zimbres Silva (mzimbres@gmail.com)
|
|
*
|
|
* Distributed under the Boost Software License, Version 1.0. (See
|
|
* accompanying file LICENSE.txt)
|
|
*/
|
|
|
|
#include <tuple>
|
|
#include <string>
|
|
#include <boost/asio.hpp>
|
|
#include <aedis.hpp>
|
|
#include <aedis/src.hpp>
|
|
|
|
namespace net = boost::asio;
|
|
|
|
using aedis::adapt;
|
|
using aedis::resp3::request;
|
|
using connection = aedis::connection<>;
|
|
|
|
int main()
|
|
{
|
|
request req;
|
|
req.push("HELLO", 3);
|
|
req.push("PING");
|
|
req.push("QUIT");
|
|
|
|
std::tuple<aedis::ignore, std::string, aedis::ignore> resp;
|
|
|
|
net::io_context ioc;
|
|
|
|
connection db{ioc};
|
|
db.async_exec("127.0.0.1", "6379", req, adapt(resp),
|
|
[](auto ec, auto) { std::cout << ec.message() << std::endl; });
|
|
|
|
ioc.run();
|
|
|
|
std::cout << std::get<1>(resp) << std::endl;
|
|
}
|