Arduino-Redis
A Redis library for Arduino.
|
Go to the documentation of this file.
85 Redis(Client &client) : conn(client) {}
109 bool set(
const char *key,
const char *value);
116 String
get(
const char *key);
123 bool del(
const char *key);
130 bool exists(
const char *key);
138 int append(
const char *key,
const char *value);
146 int publish(
const char *channel,
const char *message);
154 bool expire(
const char *key,
int seconds) {
return _expire_(key, seconds,
"EXPIRE"); }
163 bool expire_at(
const char *key,
int timestamp) {
return _expire_(key, timestamp,
"EXPIREAT"); }
171 bool pexpire(
const char *key,
int ms) {
return _expire_(key, ms,
"PEXPIRE"); }
180 bool pexpire_at(
const char *key,
int timestamp) {
return _expire_(key, timestamp,
"PEXPIREAT"); }
195 int pttl(
const char *key) {
return _ttl_(key,
"PTTL"); }
203 int ttl(
const char *key) {
return _ttl_(key,
"TTL"); }
212 bool hset(
const char *key,
const char *field,
const char *value) {
return _hset_(key, field, value,
"HSET"); }
221 bool hsetnx(
const char *key,
const char *field,
const char *value) {
return _hset_(key, field, value,
"HSETNX"); }
229 String
hget(
const char *key,
const char *field);
237 bool hdel(
const char *key,
const char *field);
244 int hlen(
const char *key);
252 int hstrlen(
const char *key,
const char *field);
260 bool hexists(
const char *key,
const char *field);
268 String
lindex(
const char *key,
int index);
276 int llen(
const char *key);
282 String
lpop(
const char *key);
289 int lpos(
const char *key,
const char *element);
297 int lpush(
const char *key,
const char *value,
bool exclusive =
false);
306 std::vector<String>
lrange(
const char *key,
int start,
int stop);
314 int lrem(
const char *key,
int count,
const char *element);
322 bool lset(
const char *key,
int index,
const char *element);
330 bool ltrim(
const char *key,
int start,
int stop);
336 String
rpop(
const char *key);
344 int rpush(
const char *key,
const char *value,
bool exclusive =
false);
349 bool subscribe(
const char *channel) {
return _subscribe(SubscribeSpec{
false, String(channel)}); }
354 bool psubscribe(
const char *pattern) {
return _subscribe(SubscribeSpec{
true, String(pattern)}); }
369 bool tsadd(
const char *key,
long timestamp,
const int value);
388 String
info(
const char *section);
401 bool _subscribe(SubscribeSpec spec);
404 std::vector<SubscribeSpec> subSpec;
405 bool subscriberMode =
false;
406 bool subLoopRun =
false;
408 bool _expire_(
const char *,
int,
const char *);
409 int _ttl_(
const char *,
const char *);
410 bool _hset_(
const char *,
const char *,
const char *,
const char *);
412 const void *_test_context;
bool lset(const char *key, int index, const char *element)
String hget(const char *key, const char *field)
@ RedisMessageBadResponseType
The underlying Redis type detected in the message is not of the type expected.
bool pexpire_at(const char *key, int timestamp)
void(* RedisMsgErrorCallback)(Redis *, RedisMessageError)
bool subscribe(const char *channel)
bool del(const char *key)
@ RedisAuthFailure
The authentication credentials used are not valid.
int lpush(const char *key, const char *value, bool exclusive=false)
String get(const char *key)
@ RedisMessageUnknownType
An unknown error occurred.
RedisSubscribeResult startSubscribing(RedisMsgCallback messageCallback, RedisMsgErrorCallback errorCallback=nullptr)
void(* RedisMsgCallback)(Redis *, String channel, String message)
bool unsubscribe(const char *channelOrPattern)
bool expire_at(const char *key, int timestamp)
@ RedisSubscribeSetupFailure
Setting up for subscription mode failed.
bool pexpire(const char *key, int ms)
Redis & operator=(const Redis &)=delete
int publish(const char *channel, const char *message)
int pttl(const char *key)
@ RedisMessageTruncatedResponse
The message response was truncated early.
bool persist(const char *key)
std::vector< String > lrange(const char *key, int start, int stop)
void setTestContext(const void *context)
int rpush(const char *key, const char *value, bool exclusive=false)
RedisReturnValue authenticate(const char *password)
String lpop(const char *key)
bool tsadd(const char *key, long timestamp, const int value)
int lpos(const char *key, const char *element)
@ RedisSubscribeOtherError
An unknown error occurred.
@ RedisSubscribeBadCallback
One of the callback parameters given is invalid.
bool hsetnx(const char *key, const char *field, const char *value)
bool exists(const char *key)
@ RedisNotConnectedFailure
Authenticate attempted before the connection has been established.
String lindex(const char *key, int index)
int hstrlen(const char *key, const char *field)
bool hdel(const char *key, const char *field)
@ RedisSubscribeServerDisconnected
The remote end disconnected, retry may be available.
int llen(const char *key)
bool hexists(const char *key, const char *field)
int append(const char *key, const char *value)
bool hset(const char *key, const char *field, const char *value)
bool psubscribe(const char *pattern)
bool set(const char *key, const char *value)
String rpop(const char *key)
const void * getTestContext()
int lrem(const char *key, int count, const char *element)
String info(const char *section)
int hlen(const char *key)
bool ltrim(const char *key, int start, int stop)
bool expire(const char *key, int seconds)