-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathredis.h
73 lines (66 loc) · 1.61 KB
/
redis.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <hiredis.h>
/**
* rdsConnect()
* Connect to a redis server
*
* Input: (Char*) server: The redis server
* Input: (Int) port: The redis server port
* Return: redisContext pointer
*/
redisContext * rdsConnect(char * server, int port);
/**
* rdsExists()
* Check if a redis exists for a key
*
* Input: (redisContext*) redis: The redis connection
* Input: (Char*) key: The unique key
* Return: Integer
*/
unsigned int rdsExists(redisContext *rc, char * key);
/**
* rdsStore()
* Store to redis
*
* Input: (redisContext*) redis: The redis connection
* Input: (Char*) key: The unique key
* Input: (Char*) data: The data to be stored
* Input: (uInt) expire: How long we retain the data (in seconds)
* Return: Integer
*/
unsigned int rdsStore(redisContext *rc,
char * key,
char * data,
unsigned int expire);
/**
* rdsFetch()
* Fetch to redis
*
* Input: (redisContext*) redis: The redis connection
* Input: (Char*) key: The unique key
* Input: (Char*) data: The data to be fetched into
* Return: Integer
*/
unsigned int rdsFetch(redisContext *rc, char * key, char ** data);
/**
* rdsDelete()
* Delete a key in the redis
*
* Input: (redisContext*) redis: The redis connection
* Input: (Char*) key: The unique key
* Return: Integer
*/
unsigned int rdsDelete(redisContext *rc, char * key);
/**
* rdsDisconnect()
* Disconnect a redis server
*
* Input: (redisContext*) redis: The redis connection
*/
void rdsDisconnect(redisContext *rc);
/**
* rdsFlush()
* Flush all redis keys
*
* Input: (redisContext*) redis: The redis connection
*/
void rdsFlush(redisContext *rc);