Esempio n. 1
0
        private async Task IncrementKeyInsideLock(String key, String lockKey, int clientNo, IRedisClientAsync client)
        {
            await using (await client.AcquireLockAsync(lockKey))
            {
                Debug.WriteLine(String.Format("client {0} acquired lock", clientNo));
                var val = await client.GetAsync <int>(key);

                await Task.Delay(200);

                await client.SetAsync(key, val + 1);

                Debug.WriteLine(String.Format("client {0} released lock", clientNo));
            }
        }