Closed afarber closed 1 year ago
You're only adding one argument to ARGV when your script is expecting two :)
try something like:
var muxer = ConnectionMultiplexer.Connect("localhost");
var db = muxer.GetDatabase();
TimeSpan RETENTION_TIME = TimeSpan.FromMinutes(30);
string LUA_CMD = @"redis.call('TS.ADD', KEYS[1], '*', ARGV[1], 'RETENTION', ARGV[2], 'ON_DUPLICATE', 'SUM', 'ENCODING', 'UNCOMPRESSED'); return redis.call('TS.RANGE', KEYS[1], '-', '+')";
RedisResult result = await db.ScriptEvaluateAsync(LUA_CMD, new RedisKey[] { "key1" }, new RedisValue[] { 1, Convert.ToInt64(RETENTION_TIME.TotalMilliseconds) });
Console.WriteLine(JsonSerializer.Serialize(result));
return 0; // a placeholder, I actually want to return a sum of the values
Thank you!
Good evening, I have a question please.
There is a command, which works perfectly at my Redis Azure Cache "redis-cli" prompt (an Enterprise E10 instance with the TimeSeries module enabled) - here I have called it 4 times in a row:
However, when I try to call the same command in a simple C# .Net console app:
Then the following line:
fails with:
Trying to debug the issue, I have tried the following 2 strings and they just work as expected:
I am just trying to call TS.ADD and the TS.RANGE as a single atomic unit from my C# app.
Currently, I am studing the ScriptingTests.cs trying to understand what is different with my code...
Thank you for any hints