Ejemplo n.º 1
0
        public static async Task QuickfireAsync(IRedisStringClient client, string label, int count = 1000)
        {
            var tasks = new List <Task>();

            for (var i = 0; i < count; i++)
            {
                var task = client.SetStringAsync(label + i, "Value" + i);
                tasks.Add(task);
            }

            await Task.WhenAll(tasks);

            tasks = new List <Task>();
            var getTasksMap = new Dictionary <int, Task <string> >();

            for (var i = 0; i < count; i++)
            {
                var task = client.GetStringAsync(label + i);
                tasks.Add(task);
                getTasksMap[i] = task;
            }

            await Task.WhenAll(tasks);

            foreach (var keyPair in getTasksMap)
            {
                Assert.Equal("Value" + keyPair.Key, keyPair.Value.Result);
            }
        }
Ejemplo n.º 2
0
        public static async Task SetGetAsync(IRedisStringClient client, string key, string expected)
        {
            await client.SetStringAsync(key, expected);

            var actual = await client.GetStringAsync(key);

            Assert.Equal(expected, actual);
        }