From 4ee14cb71ae98f64192a0f751bacff45740e4a5b Mon Sep 17 00:00:00 2001 From: gde-2 <46399182+gde-2@users.noreply.github.com> Date: Sat, 13 Nov 2021 13:10:14 +0100 Subject: [PATCH] added RTedis TimeSeries tsadd function (#46) Co-authored-by: Gerard --- Redis.cpp | 8 +++++++- Redis.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Redis.cpp b/Redis.cpp index b3a3293..d181d48 100644 --- a/Redis.cpp +++ b/Redis.cpp @@ -146,6 +146,11 @@ bool Redis::ltrim(const char *key, int start, int stop) { TRCMD_EXPECTOK("LTRIM", key, String(start), String(stop)); } + +bool Redis::tsadd(const char *key, unsigned long timestamp, const int value) +{ + TRCMD_EXPECTOK("TS.ADD" , key, String(timestamp)+"000", String(value)); +} String Redis::info(const char *section) { @@ -260,4 +265,5 @@ RedisSubscribeResult Redis::startSubscribing(RedisMsgCallback messageCallback, R } return RedisSubscribeSuccess; -} \ No newline at end of file +} + diff --git a/Redis.h b/Redis.h index 5c6a234..434c954 100644 --- a/Redis.h +++ b/Redis.h @@ -358,6 +358,7 @@ class Redis */ bool unsubscribe(const char *channelOrPattern); + bool tsadd(const char *key, unsigned long timestamp, const int value); /** * Enters subscription mode and subscribes to all channels/patterns setup via `subscribe()`/`psubscribe()`. * On success, this call will *block* until stopSubscribing() is called (meaning `loop()` will never be called!), and only *then* will return `RedisSubscribeSuccess`.