public async Task ExecuteInLockAsync(string lockKey, Func <object, Task <object> > action, object state) { var redisLock = await RedisLock.AcquireAsync(_redisDatabase, GetRedisKey(lockKey), _timeOutTimeSpan, _holdDurationTimeSpan); try { await action(state); } finally { await redisLock.DisposeAsync(); } }
public async Task ExecuteInLockAsync(string lockKey, Action action) { var redisLock = await RedisLock.AcquireAsync(_redisDatabase, GetRedisKey(lockKey), _timeOutTimeSpan, _holdDurationTimeSpan); try { action(); } finally { await redisLock.DisposeAsync(); } }