-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Being able to use #set with only expire time #877
Comments
I have another approach. |
Overloading would be backwards compatible, right? On 23:11, Wed, Feb 4, 2015 Jungtaek Lim notifications@github.com wrote:
|
@xetorthio overloading will be backwards compatible but it's not maintainable. We will need to have big methods with all optional parameters or many methods with all possible combinations. I suggest us to create a
For the SET command, we could have a SetParams:
This way we could call If you guys approve it, we could use this pattern for all commands with optional parameters (maybe for 3.0?) |
Yes, I'm aiming it for 3.0.0, fit for breaking change. |
Ok, although overloads are very convenient too.I don't know if I would have On Thu Feb 05 2015 at 11:14:55 AM Jungtaek Lim notifications@github.com
|
@xetorthio so what approach should we use?
|
I think both... but we need some rules to decide when to use each approach. On Thu Feb 05 2015 at 12:54:02 PM Nykolas Laurentino de Lima <
|
IMHO, we should keep We could use overload when command got just one optional parameter, but doing this, if the command evolve in Redis and get more optional parameters it will be more difficult to update Jedis, because we will need to add other method or change the method signature to support it. Using the |
I understand the problem I just don't think that in order to do
Instead of:
There is a 3rd option that just came to my head, which is adding a single
This last one avoids all Param classes. We could potentially remove them On Thu Feb 05 2015 at 1:03:25 PM Nykolas Laurentino de Lima <
|
We can create the We can also create static imports and it will be even more short:
I also thought it would be nice to receive a I believe that having a |
Using vargs can only work when we pass params to Redis directly, not caring what is key and what is value, and what is optional keyword. Giving users to freedom is great, but it's not good anymore when it's near raw things, means users should know sequence of parameters, what keywords it needs. |
As discussed with @xetorthio, I believe that we all agree with I'll implement it for this case and open a PR for you guys to review. Thanks! |
We currently have the method:
String set(String key, String value, String nxxx, String expx, long time)
But if we want to only pass the
ex
orpx
timeout parameter, we are not able to becausenx
orxx
parameter is required.I'm thinking in two possible solutions:
String set(String key, String value, String expx, long time)
jedis.set("myKey", "value", null, "ex", 60)
I believe that the 1. is the better solution, what do you guys think @HeartSaVioR @marcosnils ?
The text was updated successfully, but these errors were encountered: