redis_client.h

00001 
00024 #ifndef _REDIS_CLIENT_H_
00025 #define _REDIS_CLIENT_H_
00026 
00027 #include <hiredis/hiredis.h>
00028 
00029 #include "../../str.h"
00030 #include "../../parser/parse_param.h"
00031 #include "../../mod_fix.h"
00032 
00033 int redisc_init(void);
00034 int redisc_destroy(void);
00035 int redisc_add_server(char *spec);
00036 int redisc_exec(str *srv, str *cmd, str *argv1, str *argv2, str *argv3,
00037                 str *res);
00038 
00039 typedef struct redisc_server {
00040         str *sname;
00041         unsigned int hname;
00042         param_t *attrs;
00043         redisContext *ctxRedis;
00044         struct redisc_server *next;
00045 } redisc_server_t;
00046 
00047 typedef struct redisc_reply {
00048         str rname;
00049         unsigned int hname;
00050         redisReply *rplRedis;
00051         struct redisc_reply *next;
00052 } redisc_reply_t;
00053 
00054 typedef struct redisc_pv {
00055         str rname;
00056         redisc_reply_t *reply;
00057         str rkey;
00058         int rkeyid;
00059         gparam_t pos;  /* Array element position. */
00060 } redisc_pv_t;
00061 
00062 redisc_reply_t *redisc_get_reply(str *name);
00063 #endif