Skip to content
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

Should use redis.Watch to ensure proper concurrency #1

Closed
TheCloudlessSky opened this issue Jul 15, 2012 · 4 comments
Closed

Should use redis.Watch to ensure proper concurrency #1

TheCloudlessSky opened this issue Jul 15, 2012 · 4 comments

Comments

@TheCloudlessSky
Copy link
Owner

No description provided.

@TheCloudlessSky
Copy link
Owner Author

Fixed in v1.1.0

@robertmircea
Copy link

May I ask how do you treat the case when a Redis transaction fails because keys have changed and the previous watch command prevented the execution of the Redis commands?

http://redis.io/topics/transactions

In order to prevent all this concurrency problems it might be a good idea to use Redis 2.6 with Lua scripting support. Redis guarantees that the Lua script will be ran safely and in that case multiple operations on keys can be done without side effects.

http://redis.io/commands/eval

@TheCloudlessSky
Copy link
Owner Author

So, right now, it'll just fail (which isn't ideal). I'm planning on using the generational approach in my NHibernate.Caches.Redis library but I haven't had time in the past few weeks. This approach keeps the generation of the data for every Redis client in sync. I'd be happy to also accept a pull request with this too 😄 !

I do apologize for not having the time to update this, since my project's aren't currently using this code.

@TheCloudlessSky
Copy link
Owner Author

I thought I'd let you know that I just released v1.2.0 that will attempt to replay the transaction if it failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants