mirror of
https://github.com/boostorg/redis.git
synced 2026-01-19 04:42:09 +00:00
65 lines
1.3 KiB
C++
65 lines
1.3 KiB
C++
/* Copyright (c) 2019 Marcelo Zimbres Silva (mzimbres at gmail dot com)
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#include "aedis.hpp"
|
|
|
|
using namespace aedis;
|
|
|
|
void send(std::string cmd)
|
|
{
|
|
net::io_context ioc;
|
|
session s {ioc};
|
|
|
|
s.send(std::move(cmd));
|
|
|
|
s.run();
|
|
ioc.run();
|
|
}
|
|
|
|
int main(int argc, char* argv[])
|
|
{
|
|
std::list<std::string> a
|
|
{"one" ,"two", "three"};
|
|
|
|
std::set<std::string> b
|
|
{"a" ,"b", "c"};
|
|
|
|
std::map<std::string, std::string> c
|
|
{ {{"Name"}, {"Marcelo"}}
|
|
, {{"Education"}, {"Physics"}}
|
|
, {{"Job"}, {"Programmer"}}};
|
|
|
|
std::map<int, std::string> d
|
|
{ {1, {"foo"}}
|
|
, {2, {"bar"}}
|
|
, {3, {"foobar"}}
|
|
};
|
|
|
|
auto s = ping()
|
|
+ rpush("a", a)
|
|
+ lrange("a")
|
|
+ del("a")
|
|
+ multi()
|
|
+ rpush("b", b)
|
|
+ lrange("b")
|
|
+ del("b")
|
|
+ hset("c", c)
|
|
+ hvals("c")
|
|
+ zadd({"d"}, d)
|
|
+ zrange("d")
|
|
+ zrangebyscore("foo", 2, -1)
|
|
+ set("f", {"39"})
|
|
+ incr("f")
|
|
+ get("f")
|
|
+ expire("f", 10)
|
|
+ publish("g", "A message")
|
|
+ exec();
|
|
|
|
send(std::move(s));
|
|
}
|
|
|