-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathluredis.h
56 lines (44 loc) · 2.05 KB
/
luredis.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
luredis connector v1.0
luredis provide a LUA API that facilitates interaction with redis server.
Based on: hiredis, the offical C API to redis server.
BSD license.
Date: 08/29/12
(C) minhnt@live.com
How to use luredis in LUA?
[1] Create a new connection: c = luredis.new_connection("host",port)
If the connection cannot be established, the app will exit.
[2] Send a command to redis server. luredis.sendCommand(c,<command>)
The returned value is pushed onto Lua Stack.
Remember check the type of returned value before proceed.
*/
#ifndef LUREDIS_H
#define LUREDIS_H
#include "lvm_config.h"
/******************************************************************************/
/* Constants */
/******************************************************************************/
#define LUREDIS_MAXARGS 32
/* Internal buffer used in high-performance clients */
#define LUREDIS_MAX_BUF_LEN 4096 // 4KB
#define LIB_LUREDIS "luredis"
#ifdef ENABLE_REDIS_CONTEXT
#define REDIS_CONTEXT "luredis_context"
#endif
#define LUREDIS_VERSION "luredis 1.0"
#define LUREDIS_COPYRIGHT "Copyright (C) 2013 Nguyen Truong Minh (minhnt@live.com)"
#define LUREDIS_DESCRIPTION "Bindings for hiredis Redis-client library"
#define LUREDIS_REDIS_WORKER "worker"
// #define LUREDIS_ENABLE_ASYNC_REDIS_CONTEXT // remain buggy
#define DEFAULT_REDIS_SEND_RECV_TIMEOUT 2 // seconds
#define MAX_REDIS_CONNECT_FAIL_TIMES 4
#define DEFAULT_LUREDIS_DISABLE_TIME 5 // seconds
#define MAX_LUREDIS_DISABLE_TIME 60 // seconds
#define LUREDIS_MAP_CONNECTION_DICT_SIZE 64 // bigger dict size, more efficient hash table
#define LUREDIS_LOG_FILE "/tmp/luredis.log"
/******************************************************************************/
/* Luredis API */
/******************************************************************************/
int lvm_register_luredis (lua_State *L);
void lvm_close_luredis(lua_State *L);
#endif // LUREDIS_H