Arduino-Redis
A Redis library for Arduino.
|
Go to the documentation of this file.
101 Redis(Client &client) : conn(client) {}
125 bool set(
const char *key,
const char *value);
132 String
get(
const char *key);
139 bool del(
const char *key);
146 bool exists(
const char *key);
154 int append(
const char *key,
const char *value);
162 int publish(
const char *channel,
const char *message);
170 bool expire(
const char *key,
int seconds) {
return _expire_(key, seconds,
"EXPIRE"); }
179 bool expire_at(
const char *key,
int timestamp) {
return _expire_(key, timestamp,
"EXPIREAT"); }
187 bool pexpire(
const char *key,
int ms) {
return _expire_(key, ms,
"PEXPIRE"); }
196 bool pexpire_at(
const char *key,
int timestamp) {
return _expire_(key, timestamp,
"PEXPIREAT"); }
211 int pttl(
const char *key) {
return _ttl_(key,
"PTTL"); }
219 int ttl(
const char *key) {
return _ttl_(key,
"TTL"); }
228 bool hset(
const char *key,
const char *field,
const char *value) {
return _hset_(key, field, value,
"HSET"); }
237 bool hsetnx(
const char *key,
const char *field,
const char *value) {
return _hset_(key, field, value,
"HSETNX"); }
245 String
hget(
const char *key,
const char *field);
253 bool hdel(
const char *key,
const char *field);
260 int hlen(
const char *key);
268 int hstrlen(
const char *key,
const char *field);
276 bool hexists(
const char *key,
const char *field);
284 String
lindex(
const char *key,
int index);
292 int llen(
const char *key);
298 String
lpop(
const char *key);
305 int lpos(
const char *key,
const char *element);
313 int lpush(
const char *key,
const char *value,
bool exclusive =
false);
322 std::vector<String>
lrange(
const char *key,
int start,
int stop);
330 int lrem(
const char *key,
int count,
const char *element);
338 bool lset(
const char *key,
int index,
const char *element);
346 bool ltrim(
const char *key,
int start,
int stop);
352 String
rpop(
const char *key);
360 int rpush(
const char *key,
const char *value,
bool exclusive =
false);
365 bool subscribe(
const char *channel) {
return _subscribe(SubscribeSpec{
false, String(channel)}); }
370 bool psubscribe(
const char *pattern) {
return _subscribe(SubscribeSpec{
true, String(pattern)}); }
385 bool tsadd(
const char *key,
long timestamp,
const int value);
394 int xack(
const char *key,
const char *group,
const char *
id);
403 String
xadd(
const char *key,
const char *
id,
const char *field,
416 std::vector<String>
xautoclaim(
const char *key,
const char *group,
417 const char* consumer,
unsigned int min_idle_time,
const char *start,
418 unsigned int count,
bool justid);
429 std::vector<String>
xclaim(
const char *key,
const char* group,
430 const char *consumer,
431 unsigned int min_idle_time,
const char *
id,
unsigned int idle_ms,
432 unsigned int time_ms,
unsigned int retrycount,
bool force,
bool justid,
442 int xdel(
const char *key,
const char *
id);
453 bool xgroup_create(
const char *key,
const char *group,
const char *
id,
465 const char *consumer);
475 const char *consumer);
492 bool xgroup_setid(
const char* key,
const char *group,
const char *
id);
501 std::vector<String>
xinfo_consumers(
const char *key,
const char* group);
519 std::vector<String>
xinfo_stream(
const char *key,
bool full,
527 int xlen(
const char *key);
539 std::vector<String>
xpending(
const char *key,
const char* group,
540 unsigned int min_idle_time,
const char *start,
const char *end,
541 unsigned int count,
const char *consumer);
551 std::vector<String>
xrange(
const char *key,
const char *start,
552 const char *end,
unsigned int count);
560 std::vector<String>
xread(
unsigned int count,
unsigned int block,
561 const char *key,
const char *
id);
573 std::vector<String>
xreadgroup(
const char *group,
const char *consumer,
574 unsigned int count,
unsigned int block_ms,
bool noack,
const char *key,
584 std::vector<String>
xrevrange(
const char *key,
const char *end,
585 const char* start,
unsigned int count);
596 int threshold,
int count);
612 bool isNilReturn(String returnString) {
return returnString ==
"(nil)"; }
632 String
info(
const char *section);
645 bool _subscribe(SubscribeSpec spec);
648 std::vector<SubscribeSpec> subSpec;
649 bool subscriberMode =
false;
650 bool subLoopRun =
false;
652 bool _expire_(
const char *,
int,
const char *);
653 int _ttl_(
const char *,
const char *);
654 bool _hset_(
const char *,
const char *,
const char *,
const char *);
656 const void *_test_context;
bool xgroup_setid(const char *key, const char *group, const char *id)
bool lset(const char *key, int index, const char *element)
String hget(const char *key, const char *field)
int xlen(const char *key)
@ RedisMessageBadResponseType
The underlying Redis type detected in the message is not of the type expected.
bool pexpire_at(const char *key, int timestamp)
std::vector< String > xpending(const char *key, const char *group, unsigned int min_idle_time, const char *start, const char *end, unsigned int count, const char *consumer)
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.
int xgroup_destroy(const char *key, const char *group)
RedisSubscribeResult startSubscribing(RedisMsgCallback messageCallback, RedisMsgErrorCallback errorCallback=nullptr)
int xdel(const char *key, const char *id)
String xadd(const char *key, const char *id, const char *field, const char *value)
void(* RedisMsgCallback)(Redis *, String channel, String message)
int xack(const char *key, const char *group, const char *id)
int xgroup_createconsumer(const char *key, const char *group, const char *consumer)
std::vector< String > xinfo_consumers(const char *key, const char *group)
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)
std::vector< String > xrange(const char *key, const char *start, const char *end, unsigned int count)
RedisSubscribeResult startSubscribingNonBlocking(RedisMsgCallback messageCallback, LoopCallback loopCallback, RedisMsgErrorCallback errorCallback=nullptr)
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)
std::vector< String > xreadgroup(const char *group, const char *consumer, unsigned int count, unsigned int block_ms, bool noack, const char *key, const char *id)
std::vector< String > xinfo_stream(const char *key, bool full, unsigned int count)
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.
bool isErrorReturn(std::vector< String > &returnVec)
@ RedisSubscribeBadCallback
One of the callback parameters given is invalid.
bool xgroup_create(const char *key, const char *group, const char *id, bool mkstream)
bool hsetnx(const char *key, const char *field, const char *value)
bool exists(const char *key)
bool isNilReturn(String returnString)
int xgroup_delconsumer(const char *key, const char *group, const char *consumer)
@ RedisNotConnectedFailure
Authenticate attempted before the connection has been established.
String lindex(const char *key, int index)
int hstrlen(const char *key, const char *field)
std::vector< String > xinfo_groups(const char *key)
bool hdel(const char *key, const char *field)
std::vector< String > xclaim(const char *key, const char *group, const char *consumer, unsigned int min_idle_time, const char *id, unsigned int idle_ms, unsigned int time_ms, unsigned int retrycount, bool force, bool justid, const char *lastid)
@ RedisSubscribeServerDisconnected
The remote end disconnected, retry may be available.
int llen(const char *key)
bool hexists(const char *key, const char *field)
int xtrim(const char *key, const char *strategy, XtrimCompareType compare, int threshold, int count)
std::vector< String > xautoclaim(const char *key, const char *group, const char *consumer, unsigned int min_idle_time, const char *start, unsigned int count, bool justid)
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)
std::vector< String > xread(unsigned int count, unsigned int block, const char *key, const char *id)
std::vector< String > xrevrange(const char *key, const char *end, const char *start, unsigned int count)
bool expire(const char *key, int seconds)