25 #ifndef AOSSL_REDIS_INCLUDE_REDIS_INTERFACE_H_ 26 #define AOSSL_REDIS_INCLUDE_REDIS_INTERFACE_H_ 33 #include "aossl/core/include/buffers.h" 34 #include "aossl/core/include/slot_pool.h" 40 const char * what_str;
44 int_msg =
"Error Connecting to Redis: " + msg;
45 what_str = int_msg.c_str();
50 std::string msg(msg_cstr);
58 const char *
what()
const throw() {
59 std::string what_str =
"Error Connecting to Redis: " +
int_msg;
60 return what_str.c_str();
75 std::string msg(msg_cstr);
83 const char *
what()
const throw() {
84 std::string what_str =
"Error Performing Redis Operation: " +
int_msg;
85 return what_str.c_str();
124 virtual std::string load(std::string key) = 0;
130 virtual bool save(std::string key, std::string msg) = 0;
133 virtual bool setnx(std::string key, std::string msg) = 0;
136 virtual bool exists(std::string key) = 0;
139 virtual bool del(std::string key) = 0;
142 virtual bool expire(std::string key,
unsigned int second) = 0;
145 virtual bool persist(std::string key) = 0;
148 virtual bool setex(std::string key, std::string val,
unsigned int second) = 0;
151 virtual int append(std::string key, std::string val) = 0;
154 virtual int len(std::string key) = 0;
157 virtual int incr(std::string key) = 0;
160 virtual int incr(std::string key,
int incr_amt) = 0;
163 virtual int decr(std::string key) = 0;
166 virtual int decr(std::string key,
int decr_amt) = 0;
169 virtual int lpush(std::string key, std::string val) = 0;
172 virtual int rpush(std::string key, std::string val) = 0;
177 virtual std::string lpop(std::string key) = 0;
185 virtual std::string rpop(std::string key) = 0;
191 virtual bool lset(std::string key, std::string val,
int index) = 0;
194 virtual int linsert(std::string key, std::string val, std::string pivot, \
195 bool before_pivot) = 0;
200 virtual std::string lindex(std::string key,
int index) = 0;
206 virtual int llen(std::string key) = 0;
209 virtual bool ltrim(std::string key,
int start_index,
int end_index) = 0;
212 virtual std::vector<std::string> mget(std::vector<std::string> keys) = 0;
215 virtual bool mset(std::vector<RedisKvPair> save_sets) = 0;
218 virtual bool msetnx(std::vector<RedisKvPair> save_sets) = 0;
221 #endif // AOSSL_REDIS_INCLUDE_REDIS_INTERFACE_H_ RedisOperationException(std::string msg)
Create a Redis Operation Exception, and store the given error message.
Definition: redis_interface.h:71
int timeout
The timeout on the Redis Node.
Definition: redis_interface.h:104
A Structure for storing Redis Connection Information.
Definition: redis_interface.h:90
The Redis Admin.
Definition: redis_interface.h:117
int pool_size
The pool size on the Redis Node.
Definition: redis_interface.h:101
A Structure for holding a single value.
Definition: buffers.h:33
const char * what() const
Show the error message in readable format.
Definition: redis_interface.h:58
std::string ip
The IP of the Redis Node.
Definition: redis_interface.h:92
RedisConnectionException(const char *msg_cstr)
Create a Redis Connection Exception, and store the given error message.
Definition: redis_interface.h:49
A Structure for storing a Key-Value pair.
Definition: buffers.h:45
int port
The port of the Redis Node.
Definition: redis_interface.h:95
An Implementation of std::exception that denotes a connection error in Redis.
Definition: redis_interface.h:37
int role
The Role on the Redis Node.
Definition: redis_interface.h:107
const char * what() const
Show the error message in readable format.
Definition: redis_interface.h:83
Definition: redis_interface.h:66
std::string int_msg
An error message passed on initialization.
Definition: redis_interface.h:39
std::string password
The password of the Redis Node.
Definition: redis_interface.h:98
RedisOperationException(const char *msg_cstr)
Create a Redis Operation Exception, and store the given error message.
Definition: redis_interface.h:74
std::string int_msg
An error message passed on initialization.
Definition: redis_interface.h:68
RedisConnectionException(std::string msg)
Create a Redis Connection Exception, and store the given error message.
Definition: redis_interface.h:43