forked from acl-dev/acl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathredis_script.hpp
163 lines (144 loc) · 4.95 KB
/
redis_script.hpp
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#pragma once
#include "acl_cpp/acl_cpp_define.hpp"
#include <vector>
#include "acl_cpp/stdlib/string.hpp"
#include "acl_cpp/redis/redis_command.hpp"
namespace acl
{
class redis_client;
class redis_result;
class ACL_CPP_API redis_script : virtual public redis_command
{
public:
/**
* see redis_command::redis_command()
*/
redis_script();
/**
* see redis_command::redis_command(redis_client*)
*/
redis_script(redis_client* conn);
/**
* see redis_command::redis_command(redis_client_cluster*£¬ size_t)
*/
redis_script(redis_client_cluster* cluster, size_t max_conns);
virtual ~redis_script();
/////////////////////////////////////////////////////////////////////
const redis_result* eval(const char* script,
const std::vector<string>& keys,
const std::vector<string>& args);
const redis_result* eval(const char* script,
const std::vector<const char*>& keys,
const std::vector<const char*>& args);
const redis_result* evalsha(const char* sha1,
const std::vector<string>& keys,
const std::vector<string>& args);
const redis_result* evalsha(const char* sha1,
const std::vector<const char*>& keys,
const std::vector<const char*>& args);
int script_exists(const std::vector<string>& scripts,
std::vector<bool>& out);
int script_exists(const std::vector<const char*>& scripts,
std::vector<bool>& out);
bool script_flush();
bool script_load(const string& script, string& out);
bool script_kill();
/////////////////////////////////////////////////////////////////////
bool eval_status(const char* script,
const std::vector<string>& keys,
const std::vector<string>& args,
const char* success = "OK");
bool eval_number(const char* script,
const std::vector<string>& keys,
const std::vector<string>& args,
int& out);
bool eval_number64(const char* script,
const std::vector<string>& keys,
const std::vector<string>& args,
long long int& out);
int eval_string(const char* script,
const std::vector<string>& keys,
const std::vector<string>& args,
string& out);
bool evalsha_status(const char* script,
const std::vector<string>& keys,
const std::vector<string>& args,
const char* success = "OK");
bool evalsha_number(const char* script,
const std::vector<string>& keys,
const std::vector<string>& args,
int& out);
bool evalsha_number64(const char* script,
const std::vector<string>& keys,
const std::vector<string>& args,
long long int& out);
int evalsha_string(const char* script,
const std::vector<string>& keys,
const std::vector<string>& args,
string& out);
int eval_status(const char* script,
const std::vector<string>& keys,
const std::vector<string>& args,
std::vector<bool>& out,
const char* success = "OK");
int eval_number(const char* script,
const std::vector<string>& keys,
const std::vector<string>& args,
std::vector<int>& out,
std::vector<bool>& status);
long long int eval_number64(const char* script,
const std::vector<string>& keys,
const std::vector<string>& args,
std::vector<long long int>& out,
std::vector<bool>& status);
int eval_strings(const char* script,
const std::vector<string>& keys,
const std::vector<string>& args,
std::vector<string>& out);
int evalsha_status(const char* script,
const std::vector<string>& keys,
const std::vector<string>& args,
std::vector<bool>& out,
const char* success = "OK");
int evalsha_number(const char* script,
const std::vector<string>& keys,
const std::vector<string>& args,
std::vector<int>& out,
std::vector<bool>& status);
long long int evalsha_number64(const char* script,
const std::vector<string>& keys,
const std::vector<string>& args,
std::vector<long long int>& out,
std::vector<bool>& status);
int evalsha_strings(const char* script,
const std::vector<string>& keys,
const std::vector<string>& args,
std::vector<string>& out);
private:
int eval_status(const char* cmd, const char* script,
const std::vector<string>& keys,
const std::vector<string>& args,
std::vector<bool>& out,
const char* success = "OK");
int eval_number(const char* cmd, const char* script,
const std::vector<string>& keys,
const std::vector<string>& args,
std::vector<int>& out,
std::vector<bool>& status);
long long int eval_number64(const char* cmd, const char* script,
const std::vector<string>& keys,
const std::vector<string>& args,
std::vector<long long int>& out,
std::vector<bool>& status);
int eval_strings(const char* cmd, const char* script,
const std::vector<string>& keys,
const std::vector<string>& args,
std::vector<string>& out);
const redis_result* eval_cmd(const char* cmd, const char* script,
const std::vector<string>& keys,
const std::vector<string>& args);
const redis_result* eval_cmd(const char* cmd, const char* script,
const std::vector<const char*>& keys,
const std::vector<const char*>& args);
};
} // namespace acl