-
Notifications
You must be signed in to change notification settings - Fork 14
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
add .prefix options to batch() #23
Conversation
@cshum thanks for the good karma, the PR and its tests. Much appreciated! Does that cover your use case well enough? Note to self: must make a note about this in the readme. |
I have never tried Redis transactions and cluster. Doubt if it is reliable, even if supported? Should batch prefix simply returns an error if Redis cluster is used? |
Oh! I am embarrassed now: I convinced myself that this was related. And that was after morning coffee. |
@cshum I understand what the patch is doing and I am not against it. Are you sure that we must support the 3 different types of Do you think we need to support all 3 types of prefixes? |
I added 3 types just to cover more cases. The levelup prefix is what I would love to add. p.s. I wrapped another module with the same options.prefix convention. Thanks for the input! |
I hate to push back on this but I am afraid of covering all those cases: it gets messy to have code that can adapt to a lot of situations; it smells like abstractions are leaking. Would it be OK, to support extending redisdown for this?
So, I'll add the getPrefix(prefix) function to the prototype of Redisdown and provide the following implementation:
and one can override it with an implementation where levelup is handled too? If that is a good way to do it, I'll pull your PR and modify it in this manner. |
It's true that handling levelup options inside leveldown smells leaky. Thanks for your consideration on this matter! |
@cshum great! Let me know what you think of this: https://github.com/cshum/redisdown/pull/1 |
Only support string prefixes by default
Support for a custom `prefix` in the batch API.
Published in redisdown-v0.1.12. |
Thanks for the great module!
I am looking into adding level-sublevel convention of batch
.prefix
options.Since Redis MULTI works across key space, supporting batch across Redisdown instances are basically changing the location mapping.
This is definite not a standard leveldown feature, but its more idiomatic to the Redis data structure. What do you think?