acl  3.5.3.0
redis_script.hpp
浏览该文件的文档.
1 #pragma once
2 #include "../acl_cpp_define.hpp"
3 #include <vector>
4 #include "../stdlib/string.hpp"
5 #include "redis_command.hpp"
6 
7 #if !defined(ACL_CLIENT_ONLY) && !defined(ACL_REDIS_DISABLE)
8 
9 namespace acl
10 {
11 
12 class ACL_CPP_API redis_script : virtual public redis_command
13 {
14 public:
15  /**
16  * see redis_command::redis_command()
17  */
18  redis_script(void);
19 
20  /**
21  * see redis_command::redis_command(redis_client*)
22  */
24 
25  /**
26  * see redis_command::redis_command(redis_client_cluster*)
27  */
29 
31  redis_script(redis_client_cluster* cluster, size_t max_conns);
32 
34 
35  virtual ~redis_script(void);
36 
37  /////////////////////////////////////////////////////////////////////
38 
39  const redis_result* eval(const char* script,
40  const std::vector<string>& keys,
41  const std::vector<string>& args);
42  const redis_result* eval(const char* script,
43  const std::vector<const char*>& keys,
44  const std::vector<const char*>& args);
45 
46  const redis_result* evalsha(const char* sha1,
47  const std::vector<string>& keys,
48  const std::vector<string>& args);
49  const redis_result* evalsha(const char* sha1,
50  const std::vector<const char*>& keys,
51  const std::vector<const char*>& args);
52 
53  int script_exists(const std::vector<string>& scripts,
54  std::vector<bool>& out);
55  int script_exists(const std::vector<const char*>& scripts,
56  std::vector<bool>& out);
57 
58  bool script_flush();
59  bool script_load(const string& script, string& out);
60  bool script_kill();
61 
62  /////////////////////////////////////////////////////////////////////
63 
64  bool eval_status(const char* script,
65  const std::vector<string>& keys,
66  const std::vector<string>& args,
67  const char* success = "OK");
68  bool eval_number(const char* script,
69  const std::vector<string>& keys,
70  const std::vector<string>& args,
71  int& out);
72  bool eval_number64(const char* script,
73  const std::vector<string>& keys,
74  const std::vector<string>& args,
75  long long int& out);
76  int eval_string(const char* script,
77  const std::vector<string>& keys,
78  const std::vector<string>& args,
79  string& out);
80 
81  bool evalsha_status(const char* script,
82  const std::vector<string>& keys,
83  const std::vector<string>& args,
84  const char* success = "OK");
85  bool evalsha_number(const char* script,
86  const std::vector<string>& keys,
87  const std::vector<string>& args,
88  int& out);
89  bool evalsha_number64(const char* script,
90  const std::vector<string>& keys,
91  const std::vector<string>& args,
92  long long int& out);
93  int evalsha_string(const char* script,
94  const std::vector<string>& keys,
95  const std::vector<string>& args,
96  string& out);
97 
98  int eval_status(const char* script,
99  const std::vector<string>& keys,
100  const std::vector<string>& args,
101  std::vector<bool>& out,
102  const char* success = "OK");
103  int eval_number(const char* script,
104  const std::vector<string>& keys,
105  const std::vector<string>& args,
106  std::vector<int>& out,
107  std::vector<bool>& status);
108  long long int eval_number64(const char* script,
109  const std::vector<string>& keys,
110  const std::vector<string>& args,
111  std::vector<long long int>& out,
112  std::vector<bool>& status);
113  int eval_strings(const char* script,
114  const std::vector<string>& keys,
115  const std::vector<string>& args,
116  std::vector<string>& out);
117 
118  int evalsha_status(const char* script,
119  const std::vector<string>& keys,
120  const std::vector<string>& args,
121  std::vector<bool>& out,
122  const char* success = "OK");
123  int evalsha_number(const char* script,
124  const std::vector<string>& keys,
125  const std::vector<string>& args,
126  std::vector<int>& out,
127  std::vector<bool>& status);
128  long long int evalsha_number64(const char* script,
129  const std::vector<string>& keys,
130  const std::vector<string>& args,
131  std::vector<long long int>& out,
132  std::vector<bool>& status);
133  int evalsha_strings(const char* script,
134  const std::vector<string>& keys,
135  const std::vector<string>& args,
136  std::vector<string>& out);
137 
138 private:
139  int eval_status(const char* cmd, const char* script,
140  const std::vector<string>& keys,
141  const std::vector<string>& args,
142  std::vector<bool>& out,
143  const char* success = "OK");
144  int eval_number(const char* cmd, const char* script,
145  const std::vector<string>& keys,
146  const std::vector<string>& args,
147  std::vector<int>& out,
148  std::vector<bool>& status);
149  long long int eval_number64(const char* cmd, const char* script,
150  const std::vector<string>& keys,
151  const std::vector<string>& args,
152  std::vector<long long int>& out,
153  std::vector<bool>& status);
154  int eval_strings(const char* cmd, const char* script,
155  const std::vector<string>& keys,
156  const std::vector<string>& args,
157  std::vector<string>& out);
158 
159  const redis_result* eval_cmd(const char* cmd, const char* script,
160  const std::vector<string>& keys,
161  const std::vector<string>& args);
162  const redis_result* eval_cmd(const char* cmd, const char* script,
163  const std::vector<const char*>& keys,
164  const std::vector<const char*>& args);
165 };
166 
167 } // namespace acl
168 
169 #endif // !defined(ACL_CLIENT_ONLY) && !defined(ACL_REDIS_DISABLE)
#define ACL_CPP_DEPRECATED
Definition: atomic.hpp:86
#define ACL_CPP_API