.Net Client for RedisTimeSeries
As of nredisstack 0.4.1 this library is deprecated. It's features have been merged into [nredisstack](https://github.com/redis/nredisstack. Please either install it from nuget or the repo.
The complete documentation of RedisTimeSeries's commands can be found at RedisTimeSeries's website.
ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("localhost");
IDatabase db = redis.GetDatabase();
// Create
var label = new TimeSeriesLabel("Time", "Series");
db.TimeSeriesCreate("test", retentionTime: 5000, labels: new List<TimeSeriesLabel> { label }, duplicatePolicy: TsDuplicatePolicy.MAX);
// Alter
label = new TimeSeriesLabel("Alter", "label");
db.TimeSeriesAlter("test", retentionTime: 0, labels: new List<TimeSeriesLabel> { label });
// Add
db.TimeSeriesAdd("test", 1, 1.12);
db.TimeSeriesAdd("test", 1, 1.13, duplicatePolicy: TsDuplicatePolicy.LAST);
// MAdd
var sequence = new List<(string, TimeStamp, double)>(3);
sequence.Add(("test", "*", 0.0));
sequence.Add(("test", DateTime.UtcNow, 0.0));
sequence.Add(("test", 1, 1.0));
db.TimeSeriesMAdd(sequence);
// Rule
db.TimeSeriesCreate("sumRule");
TimeSeriesRule rule = new TimeSeriesRule("sumRule", 20, TsAggregation.Sum);
db.TimeSeriesCreateRule("test", rule);
db.TimeSeriesAdd("test", "*", 1);
db.TimeSeriesAdd("test", "*", 2);
db.TimeSeriesDeleteRule("test", "sumRule");
db.KeyDelete("sumRule");
// Range
db.TimeSeriesRange("test", "-", "+");
db.TimeSeriesRange("test", "-", "+", aggregation: TsAggregation.Avg, timeBucket: 10);
// Get
db.TimeSeriesGet("test");
// Info
TimeSeriesInformation info = db.TimeSeriesInfo("test");
// DEL
db.KeyDelete("test");
Since RedisTimeSeries 1.4 we've added the ability to back-fill time series, with different duplicate policies.
The default behavior is to block updates to the same timestamp, and you can control it via the duplicatePolicy
argument. You can check in detail the duplicate policy documentation.
See the Example project for commands reference