Roslyn-based analyzer for StackExchange.Redis library
Async methods on ITransaction type shouldn't be blocked
Noncompliant Code Example:
var transaction = db.CreateTransaction();
await transaction.StringSetAsync("key", "value").ConfigureAwait(false);
await transaction.ExecuteAsync().ConfigureAwait(false);
Compliant Solution:
var transaction = db.CreateTransaction();
transaction.StringSetAsync("key", "value").ConfigureAwait(false);
await transaction.ExecuteAsync().ConfigureAwait(false);
Sending commands in a loop can be slow, batch overload with array of keys instead
Noncompliant Code Example:
foreach (var key in new[] { "one", "two" })
{
var value = db.StringGetAsync(key);
}
Compliant Solution:
var results = db.StringGetAsync(new[] { "one", "two" });