-
Notifications
You must be signed in to change notification settings - Fork 9
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
Transactions (MULTI) support #7
Comments
Hello @Sija, Ohm uses Lua scripts in order to make operations atomic. In the past, before scripts were available, we relied on |
I'd need to have My use case is as follows: store = Store::Redis.new
store.transaction do
store.clear # persist only when `#update` call below succeeds.
store.update(fetch_data)
end |
Ah, I'm afraid it's not possible with either |
IIRC it has been implemented by crystal-redis shard. |
Gotcha! Ohm is like an ORM for Redis, while crystal-redis is a Redis client. Ohm uses a different Redis client called Resp. With Resp you can build transactions with |
I'm aware of that, yet I couldn't find anything about |
Here's an example of how you can use c = Resp.new("redis://localhost:6379")
c.queue("MULTI")
c.queue("ECHO", "hello")
c.queue("ECHO", "world")
c.queue("EXEC")
assert_equal ["hello", "world"], c.commit.last
|
As per https://redis.io/topics/transactions.
The text was updated successfully, but these errors were encountered: