-
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
Add a distinct type for keys? #29
Comments
I'm not sure how that relates to the wire protocol. Looking at your example, it's already easy to see a possible solution: make |
Indeed, and that's how I'll implement it anyway, but if it's not enforced by the protocol, switching a simple client for a cluster client becomes much more problematic. |
And also it makes it easy for proxies to blindly extract the keys without having to know the commands signatures. |
I see your point now. Redis knows already which args are keys or not, the client that produced the query can know because it must offer to the user a constructor for this hypotetical type, like we mentioned before. So, other than proxies, who else would benefit for this information showing up in RESP? One last point: Proxies could use "COMMAND" to learn the key mappings for basically all commands. |
Well, that is not the intent @antirez expressed in his blog post:
Not having to maintain the list of command signatures in the client would significantly reduce their complexity, and would also allow to support extensions ou of the box without having to modify anything in the client.
That's actually a good point. |
Hi,
According to http://antirez.com/news/125 the goal with RESP3 is to be able to have relatively dumb clients which offer a very simple interface such as
result = redis.call(“GET”,keyname);
and don't need to know anything about the command it sends.As the current maintainer of
redis-rb
, I'm totally behind this as it would indeed make my life much easier, and I'm really eager to be able to delete tons of code.However I question wether such simplicity will really be achievable in practice. With a regular Redis setup it will indeed be possible, but as soon as you use Redis in a distributed manner, say with Redis cluster, the client do need to know which elements of the command are keys, so that it can hash them and select the proper target.
So ultimately I'm afraid the client will still have to maintain a list of commands, as well as their possible arguments as to be able to extract keys.
Hence why I wonder if
keys
could be a distinct type from strings, with their own prefix such as#
or@
.This way, rather than
redis.call("GET", "foo")
, the interface would be something likeredis.call("GET", redis.key("foo"))
, allowing the client to extract the keys without having to know anything about the command signature.The text was updated successfully, but these errors were encountered: