-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Transaction for Redis Stack Commands #78
Comments
public class Transactions
{
public Transactions(IConnectionMultiplexer muxer)
{
_transaction = muxer.GetDatabase().CreateTransaction();
}
public Transactions(IDatabase db)
{
_transaction = db.CreateTransaction();
}
private ITransaction _transaction;
public void AddCondition(Condition condition)
{
_transaction.AddCondition(condition);
}
public void Execute()
{
_transaction.Execute();
}
public void ExecuteAsync()
{
_transaction.ExecuteAsync();
}
} @shacharPash does this helps? |
Yes 👍 |
I'll work on the PR.
Do modules support only |
Any command has Sync and Async version. When you use Pipelines or Transaction, you only has access to the async methods - because the result of |
@shacharPash #79 was created for drafted one transaction support and should add some more tests |
[Fact]
public void TransactionExample()
{
var tran = new Transactions(ConnectionMultiplexer.Connect("localhost"));
tran.AddCondition(Condition.HashNotExists("profesor:5555", "first")); // Condition class
tran.Db.HashSetAsync("profesor:5555", new HashEntry[] { new("first", "Albert"), new("last", "Blue"), new("age", "55") });
var condition = tran.ExecuteAsync();
Assert.True(condition.Result);
} |
similar to pipelines (#50).
with
MULTI
andEXEC
.The text was updated successfully, but these errors were encountered: