2019-07-28 10:31:56 +08:00
|
|
|
#pragma once
|
2017-06-02 14:47:24 +08:00
|
|
|
#include "../acl_cpp_define.hpp"
|
2015-01-25 21:03:20 +08:00
|
|
|
#include <vector>
|
2017-06-02 14:47:24 +08:00
|
|
|
#include "../stdlib/string.hpp"
|
|
|
|
#include "redis_command.hpp"
|
2015-01-21 23:39:02 +08:00
|
|
|
|
2019-05-19 16:54:20 +08:00
|
|
|
#if !defined(ACL_CLIENT_ONLY) && !defined(ACL_REDIS_DISABLE)
|
2019-05-18 21:19:21 +08:00
|
|
|
|
2024-07-22 17:07:57 +08:00
|
|
|
namespace acl {
|
2015-01-21 23:39:02 +08:00
|
|
|
|
2024-07-22 17:07:57 +08:00
|
|
|
class ACL_CPP_API redis_script : virtual public redis_command {
|
2015-01-21 23:39:02 +08:00
|
|
|
public:
|
2015-03-29 19:27:41 +08:00
|
|
|
/**
|
|
|
|
* see redis_command::redis_command()
|
|
|
|
*/
|
2024-07-22 17:07:57 +08:00
|
|
|
redis_script();
|
2015-03-29 19:27:41 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* see redis_command::redis_command(redis_client*)
|
|
|
|
*/
|
2015-03-27 17:05:12 +08:00
|
|
|
redis_script(redis_client* conn);
|
2015-03-29 19:27:41 +08:00
|
|
|
|
|
|
|
/**
|
2020-07-20 11:21:47 +08:00
|
|
|
* see redis_command::redis_command(redis_client_cluster*)
|
2015-03-29 19:27:41 +08:00
|
|
|
*/
|
2020-07-20 11:21:47 +08:00
|
|
|
redis_script(redis_client_cluster* cluster);
|
|
|
|
|
|
|
|
ACL_CPP_DEPRECATED
|
|
|
|
redis_script(redis_client_cluster* cluster, size_t max_conns);
|
2015-03-29 19:27:41 +08:00
|
|
|
|
2021-01-09 23:16:15 +08:00
|
|
|
redis_script(redis_client_pipeline* pipeline);
|
|
|
|
|
2024-07-22 17:07:57 +08:00
|
|
|
virtual ~redis_script();
|
2015-01-25 21:03:20 +08:00
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
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);
|
2015-01-21 23:39:02 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace acl
|
2019-05-18 21:19:21 +08:00
|
|
|
|
2019-05-19 16:54:20 +08:00
|
|
|
#endif // !defined(ACL_CLIENT_ONLY) && !defined(ACL_REDIS_DISABLE)
|