summaryrefslogtreecommitdiff
path: root/examples/example-libevent.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/example-libevent.c')
-rw-r--r--examples/example-libevent.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/examples/example-libevent.c b/examples/example-libevent.c
index 747f343..efc21d6 100644
--- a/examples/example-libevent.c
+++ b/examples/example-libevent.c
@@ -13,8 +13,8 @@
#include <async.h>
#include <adapters/libevent.h>
-void getCallback(redisAsyncContext *c, void *r, void *privdata) {
- redisReply *reply = r;
+void getCallback(redictAsyncContext *c, void *r, void *privdata) {
+ redictReply *reply = r;
if (reply == NULL) {
if (c->errstr) {
printf("errstr: %s\n", c->errstr);
@@ -24,19 +24,19 @@ void getCallback(redisAsyncContext *c, void *r, void *privdata) {
printf("argv[%s]: %s\n", (char*)privdata, reply->str);
/* Disconnect after receiving the reply to GET */
- redisAsyncDisconnect(c);
+ redictAsyncDisconnect(c);
}
-void connectCallback(const redisAsyncContext *c, int status) {
- if (status != REDIS_OK) {
+void connectCallback(const redictAsyncContext *c, int status) {
+ if (status != REDICT_OK) {
printf("Error: %s\n", c->errstr);
return;
}
printf("Connected...\n");
}
-void disconnectCallback(const redisAsyncContext *c, int status) {
- if (status != REDIS_OK) {
+void disconnectCallback(const redictAsyncContext *c, int status) {
+ if (status != REDICT_OK) {
printf("Error: %s\n", c->errstr);
return;
}
@@ -49,25 +49,25 @@ int main (int argc, char **argv) {
#endif
struct event_base *base = event_base_new();
- redisOptions options = {0};
- REDIS_OPTIONS_SET_TCP(&options, "127.0.0.1", 6379);
+ redictOptions options = {0};
+ REDICT_OPTIONS_SET_TCP(&options, "127.0.0.1", 6379);
struct timeval tv = {0};
tv.tv_sec = 1;
options.connect_timeout = &tv;
- redisAsyncContext *c = redisAsyncConnectWithOptions(&options);
+ redictAsyncContext *c = redictAsyncConnectWithOptions(&options);
if (c->err) {
/* Let *c leak for now... */
printf("Error: %s\n", c->errstr);
return 1;
}
- redisLibeventAttach(c,base);
- redisAsyncSetConnectCallback(c,connectCallback);
- redisAsyncSetDisconnectCallback(c,disconnectCallback);
- redisAsyncCommand(c, NULL, NULL, "SET key %b", argv[argc-1], strlen(argv[argc-1]));
- redisAsyncCommand(c, getCallback, (char*)"end-1", "GET key");
+ redictLibeventAttach(c,base);
+ redictAsyncSetConnectCallback(c,connectCallback);
+ redictAsyncSetDisconnectCallback(c,disconnectCallback);
+ redictAsyncCommand(c, NULL, NULL, "SET key %b", argv[argc-1], strlen(argv[argc-1]));
+ redictAsyncCommand(c, getCallback, (char*)"end-1", "GET key");
event_base_dispatch(base);
return 0;
}