-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathAlterExampleAsync.cs
29 lines (28 loc) · 1.15 KB
/
AlterExampleAsync.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using NRedisTimeSeries.DataTypes;
using StackExchange.Redis;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace NRedisTimeSeries.Example
{
/// <summary>
/// Examples for NRedisTimeSeries async API for altering time series properties.
/// </summary>
internal class AlterAsyncExample
{
/// <summary>
/// Examples for altering time-series.
/// The parameters retentionTime, and labels are optional and can be set in any order when used as named argument.
/// </summary>
public static async Task ParameterizedAlterAsync()
{
ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("localhost");
IDatabase db = redis.GetDatabase();
var label = new TimeSeriesLabel("key", "value");
var labels = new List<TimeSeriesLabel> { label };
await db.TimeSeriesAlterAsync("labeld_ts", labels: labels);
await db.TimeSeriesAlterAsync("retention_time_ts", retentionTime: 5000);
await db.TimeSeriesAlterAsync("parameterized_ts", retentionTime: 5000, labels: labels);
redis.Close();
}
}
}