下面的 3 个命令在按原样执行时可以完美运行。
using (var redis = NewRedisConnection)
{
await redis.Open();
var allKeys = await redis.Keys.Find(db, "searchPattern");
var allVals = await redis.Strings.GetString(db, allKeys);
await redis.Keys.Remove(db, allKeys);
//process the data I pull from redis
}
但是,当我尝试将它们包装在事务中时,它会停止工作。不会引发异常,但是如果我调试执行似乎会停止在var allKeys = ...
设置事务时是否遗漏了什么?
using (var redis = NewRedisConnection)
{
await redis.Open();
var tran = redis.Createtransaction();
var allKeys = await tran.Keys.Find(db, "searchPattern");
var allVals = await tran.Strings.GetString(db, allKeys);
await tran.Keys.Remove(db, allKeys);
await tran.Execute();
//process the data I pull from redis
}