I am trying to get multiple set at the same time by keys. I am using the Basic tier of Azure Redis, with latest Stackexchange.Redis (1.1.608)
Here is my code:
var tasks = new List<Task<RedisValue[]>>();
foreach (var key in keys)
{
tasks.Add(redisCacheDB.SetMembersAsync(key));
}
var buildLinksJsonArray = await Task.WhenAll(tasks);
For ~120 keys (most of them are not existed), it takes ~10 seconds to finish the pipeline. What am I doing wrong?
I also try SetScan, but I can never get it not timeout. Also, I am not sure I want to execute 120 SetScan sequentially.
Thanks,
Edit: Each set only has ~20 members. I tried some different approach yesterday:
Batching: Take around 5 second
Set Union: Takes around 1~2 second. (I do redis.SetUnion(list of key))
For now I am using the Set Union since it's taking the shortest time. However, I still believe 2 seconds are way longer than it should have taken to retrieve ~120 sets. Anybody have any idea? I am open to suggestion.