|
1 | 1 | # async-redis
|
2 |
| -Another redis library written in c++1y with using libev(and an interface to support other event-loop driven designs). |
| 2 | +An async redis library with sentinel support based on (libevpp|ASIO). |
3 | 3 |
|
4 |
| -###[Still under heavy development] |
5 |
| -Right now it's just a redis library but I'm gonna separate the IO/Network package out to use it for other things as well. |
| 4 | +# LibEvPP |
| 5 | +It's a library written by the same author. It's library based on libEv. |
6 | 6 |
|
7 |
| -##INSTALL |
8 |
| -Create a directory in root for generate CMake output file. |
9 |
| -``` |
10 |
| -mkdir build |
11 |
| -cd build |
12 |
| -``` |
13 |
| -Call cmake and pass project root directory as CMakeList path then call make install with sudo permission. |
14 |
| -``` |
15 |
| -cmake .. |
16 |
| -sudo make install |
17 |
| -``` |
18 |
| -You can use event_loop and parser as link library for your project and pass /usr/local/include as include directory. |
19 |
| -##Show me an example: |
20 |
| - |
21 |
| -```C++ |
22 |
| -#include <memory> |
23 |
| -#include <iostream> |
24 |
| - |
25 |
| -#include <event_loop/event_loop_ev.h> |
26 |
| -#include <redis_client.hpp> |
27 |
| -#include <parser/base_resp_parser.h> |
28 |
| -#include <network/tcp_socket.hpp> |
29 |
| -#include <network/unix_socket.hpp> |
30 |
| - |
31 |
| -int main(int argc, char** args) |
32 |
| -{ |
33 |
| - async_redis::event_loop::event_loop_ev loop; |
34 |
| - //If you want tcp socket |
35 |
| - // using redis_client_t = async_redis::redis_impl::redis_client<decltype(loop), async_redis::network::tcp_socket>; |
36 |
| - using redis_client_t = async_redis::redis_impl::redis_client<decltype(loop), async_redis::network::unix_socket>; |
37 |
| - using parser_t = typename redis_client_t::parser_t; |
38 | 7 |
|
39 |
| - //a tcp client with 4 connections |
40 |
| - auto client_ptr = std::make_unique<redis_client_t>(loop, 4); |
| 8 | +###[Road map] |
| 9 | +** Write more examples. |
| 10 | +** Write a sentinel interface. |
| 11 | +** Write tests. |
41 | 12 |
|
42 |
| - auto connect = [&](bool res) |
43 |
| - { |
44 |
| - |
45 |
| - //all 4 connections should be available for "res" to be True |
46 |
| - if (!res) { |
47 |
| - std::cout << "didn't connect!" << std::endl; |
48 |
| - return; |
49 |
| - } |
50 |
| - |
51 |
| - //all commands are defined as methods |
52 |
| - client.get("hamid", [&](parser_t parsed) { |
53 |
| - std::cout <<"get hamid =>" << parsed->to_string()<< std::endl; |
54 |
| - }); |
55 |
| - }; |
56 |
| - |
57 |
| - //if you want tcp_socket |
58 |
| - // client.connect(connect, "127.0.0.1", 6379); |
59 |
| - client.connect(connect, "/tmp/redis.sock"); |
60 |
| - |
61 |
| - loop.run(); |
62 |
| - |
63 |
| - return 0; |
64 |
| -} |
65 | 13 |
|
| 14 | +##INSTALL |
66 | 15 | ```
|
| 16 | +bash ./build.sh |
| 17 | +``` |
| 18 | +You can use event_loop and parser as link library for your project and pass /usr/local/include as include directory. |
0 commit comments