#pragma once #include "../acl_cpp_define.hpp" #include #include "../stdlib/string.hpp" #include "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(void); /** * 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 = 0); virtual ~redis_script(void); ///////////////////////////////////////////////////////////////////// const redis_result* eval(const char* script, const std::vector& keys, const std::vector& args); const redis_result* eval(const char* script, const std::vector& keys, const std::vector& args); const redis_result* evalsha(const char* sha1, const std::vector& keys, const std::vector& args); const redis_result* evalsha(const char* sha1, const std::vector& keys, const std::vector& args); int script_exists(const std::vector& scripts, std::vector& out); int script_exists(const std::vector& scripts, std::vector& out); bool script_flush(); bool script_load(const string& script, string& out); bool script_kill(); ///////////////////////////////////////////////////////////////////// bool eval_status(const char* script, const std::vector& keys, const std::vector& args, const char* success = "OK"); bool eval_number(const char* script, const std::vector& keys, const std::vector& args, int& out); bool eval_number64(const char* script, const std::vector& keys, const std::vector& args, long long int& out); int eval_string(const char* script, const std::vector& keys, const std::vector& args, string& out); bool evalsha_status(const char* script, const std::vector& keys, const std::vector& args, const char* success = "OK"); bool evalsha_number(const char* script, const std::vector& keys, const std::vector& args, int& out); bool evalsha_number64(const char* script, const std::vector& keys, const std::vector& args, long long int& out); int evalsha_string(const char* script, const std::vector& keys, const std::vector& args, string& out); int eval_status(const char* script, const std::vector& keys, const std::vector& args, std::vector& out, const char* success = "OK"); int eval_number(const char* script, const std::vector& keys, const std::vector& args, std::vector& out, std::vector& status); long long int eval_number64(const char* script, const std::vector& keys, const std::vector& args, std::vector& out, std::vector& status); int eval_strings(const char* script, const std::vector& keys, const std::vector& args, std::vector& out); int evalsha_status(const char* script, const std::vector& keys, const std::vector& args, std::vector& out, const char* success = "OK"); int evalsha_number(const char* script, const std::vector& keys, const std::vector& args, std::vector& out, std::vector& status); long long int evalsha_number64(const char* script, const std::vector& keys, const std::vector& args, std::vector& out, std::vector& status); int evalsha_strings(const char* script, const std::vector& keys, const std::vector& args, std::vector& out); private: int eval_status(const char* cmd, const char* script, const std::vector& keys, const std::vector& args, std::vector& out, const char* success = "OK"); int eval_number(const char* cmd, const char* script, const std::vector& keys, const std::vector& args, std::vector& out, std::vector& status); long long int eval_number64(const char* cmd, const char* script, const std::vector& keys, const std::vector& args, std::vector& out, std::vector& status); int eval_strings(const char* cmd, const char* script, const std::vector& keys, const std::vector& args, std::vector& out); const redis_result* eval_cmd(const char* cmd, const char* script, const std::vector& keys, const std::vector& args); const redis_result* eval_cmd(const char* cmd, const char* script, const std::vector& keys, const std::vector& args); }; } // namespace acl