-
Notifications
You must be signed in to change notification settings - Fork 342
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
all()
why KEYS and MULTI?
#203
Comments
/cc @anotherpit |
@naholyr |
@naholyr |
Hello-- I am wondering if it is on the roadmap to get @naholyr 's feedback into the codebase? I am not super versed yet with Redis but would be willing to help with testing if necessary. |
OK on it, I'll check if ids() would enjoy the change too and get back to you |
Thanks @naholyr ! |
Resolved in |
I have an existing implementation of
all()
method, but before submitting a PR I want to discuss the matters, one I'm sure of, the other one I may have missed something.Using
KEYS
is badAs the Redis documentation clearly states,
KEYS
should be avoided in production code: it blocks the entire database during computation. I alread had issues with this, it's not to be underrated, a thousand keys can be enough to block almot a second, which means your database will quickly stack delays and the whole system will fall down. This is serious business ;)The solution is to use consecutive calls to
SCAN
(maybe in aMULTI
?).Why using
MULTI
+GET
instead ofMGET
?I've seen you were calling
MULTI
then oneGET
per session key, and finally execute the transaction. But why not using directlyMGET
? Is there a specific reason I'm not aware of?Code sample
My current implementation (the one I used before
#all()
landed here):The text was updated successfully, but these errors were encountered: