//public static void ExecTrans(this IRedisClientsManager redisManager, Action<IRedisTransaction> lambda) //{ // using (var redis = redisManager.GetClient()) // using (var trans = redis.CreateTransaction()) // { // lambda(trans); // trans.Commit(); // } //} public static async ValueTask ExecAsAsync <T>(this IRedisClientsManager redisManager, Func <IRedisTypedClientAsync <T>, ValueTask> lambda) { await using var redis = await redisManager.GetClientAsync().ConfigureAwait(false); await lambda(redis.As <T>()).ConfigureAwait(false); }
public static async ValueTask <T> ExecAsync <T>(this IRedisClientsManager redisManager, Func <IRedisClientAsync, ValueTask <T> > lambda) { await using var redis = await redisManager.GetClientAsync().ConfigureAwait(false); return(await lambda(redis).ConfigureAwait(false)); }