When trying to write a large amount of keys and values to the DB concurrently using the _db.HashSetAsync(...)
function I noticed that many values are actually not written to the DB but there is no exception or error.
How do I know if the HashSet call has been successful or not? I want to know if my values were written.
My code looks something like the following:
var _redis = ConnectionMultiplexer.Connect("localhost");
var _db = _redis.GetDataBase();
await Task.Run(() =>
{
Parallel.For(0,10000,
async index => {await _db.HashSetAsync("id:"+i, new HashEntry[] {new HashEntry("Field","value")});});
});
When I checked, the database has way fewer keys than 10000.
Is something wrong in my code? How do I know which HashSetAsync
call has worked and which hasn't?