Ejemplo n.º 1
0
        public async Task Does_not_set_Expiry_on_existing_key_in_transaction()
        {
            var expiresIn = TimeSpan.FromMinutes(15);

            var key = "Exting TTL-Transaction";
            await RedisAsync.AddAsync(key, "Foo");

            await using (var trans = await RedisAsync.CreateTransactionAsync())
            {
                trans.QueueCommand(r => r.AddAsync(key, "Bar", expiresIn).AsValueTask());

                if (!await trans.CommitAsync())
                {
                    throw new Exception("Transaction Failed");
                }
            }

            Assert.That(await RedisAsync.GetAsync <string>(key), Is.EqualTo("Foo"));
            Assert.That(await RedisAsync.GetTimeToLiveAsync(key), Is.EqualTo(TimeSpan.MaxValue));
        }