redis3m  1.0.0
 All Classes Functions Variables Enumerations Pages
script_exec.h
1 // Copyright (c) 2014 Luca Marturana. All rights reserved.
2 // Licensed under Apache 2.0, see LICENSE for details
3 
4 #pragma once
5 
6 #include <redis3m/reply.h>
7 #include <redis3m/connection.h>
8 #include <vector>
9 #include <string>
10 
11 namespace redis3m {
12 namespace patterns
13 {
14 
21 class script_exec {
22 public:
29  script_exec(const std::string& script, bool is_path=false);
30 
38  reply exec(connection::ptr_t connection,
39  const std::vector<std::string>& keys=std::vector<std::string>(),
40  const std::vector<std::string>& args=std::vector<std::string>());
41 private:
42  std::string _script;
43  bool _is_path;
44  std::string _sha1;
45 };
46 }
47 }
The connection class, represent a connection to a Redis server.
Definition: connection.h:27
Helps to run Lua scripts on a Redis instance. It will take care to use EVALSHA to optimize performanc...
Definition: script_exec.h:21
Represent a reply received from redis server.
Definition: reply.h:18
script_exec(const std::string &script, bool is_path=false)
Create script_exec.
Definition: script_exec.cpp:12
reply exec(connection::ptr_t connection, const std::vector< std::string > &keys=std::vector< std::string >(), const std::vector< std::string > &args=std::vector< std::string >())
Execute the script. First trying with EVALSHA, then with EVAL.
Definition: script_exec.cpp:31