Skip to content

Commit 98c807f

Browse files
author
hamidr
committed
A better readme
1 parent b0bc663 commit 98c807f

File tree

4 files changed

+18
-149
lines changed

4 files changed

+18
-149
lines changed

README.md

Lines changed: 11 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,18 @@
11
# 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).
33

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.
66

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;
387

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.
4112

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-
}
6513

14+
##INSTALL
6615
```
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.

build.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
git submodule init
2+
git submodule update
3+
mkdir -p build && cd build
4+
cmake ..
5+
make
6+
cd ..

examples/tcp_server.hpp

Lines changed: 0 additions & 90 deletions
This file was deleted.

test/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <libevpp/event_loop/event_loop_ev.h>
22

3+
#include <iostream>
34
#include <async_redis/redis_client.hpp>
45
#include <async_redis/parser/base_resp_parser.h>
56
#include <libevpp/network/tcp_socket.hpp>

0 commit comments

Comments
 (0)