带有 IncrementKey 的 ActionSuccess 回调在事务中不起作用:
public class Article
{
public long Id { get; set; }
public string Name { get; set; }
}
[Test]
public void Can_create_article_with_autoincremental-id()
{
Article a = new Article() { Name = "I Love Writing Test" };
using (var trans = Redis.CreateTransaction())
{
trans.QueueCommand(r => r.IncrementValue("id:article"), id => a.Id = id);
trans.QueueCommand(r => r.Store<Article>(a));
trans.Commit();
}
Assert.That(Redis.Get<Article>("1").Id,Is.Equal("1"));
}