I am calling Redis with a batch request, though it seems that my code is continuing past the Await Task WhenAll statement before the cache has been updated. Am I awaiting the tasks in the wrong way?
ClearKey($"ordersList:{apiAccount.Id}");
var list = new List<Task<long>>();
IBatch batch = _redisDb.CreateBatch();
string listKey = $"ordersList:{apiAccount.Id}";
foreach (Order order in ordersList)
{
var task = batch.ListRightPushAsync(listKey, Serialize(order));
list.Add(task);
}
batch.Execute();
await Task.WhenAll(list.ToArray());
// Call other apps to say "cache is updated!" - This is triggering before cache actually gets updated.