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

refactoring set command to use SetParams for the optional parameters #878

Merged
merged 10 commits into from
Aug 4, 2015

Conversation

nykolaslima
Copy link
Contributor

It closes #877

  1. I let the binary layer receiving all the possible parameters. The binary layer was receiving expire time in long instead of byte[], so I also change it.
  2. I removed the set methods that receive only a few optional parameters.
  3. The other layers(command interfaces and implementations) will receive the SetParams.

@xetorthio
Copy link
Contributor

I think that checking arguments is not necessary and actually wrong.
Redis allows to send both EX and PX on the same command.
And even EX and NX. If you check, redis doesn't return an error and doesn't complain. Why should we?

@nykolaslima
Copy link
Contributor Author

@xetorthio in my opinion, Redis should also complain about it. If we set both, EX and PX, what expire time should be used? And if we set both EX and NX, no value will be returned.

We know that those values are wrong, so why don't warning the user about it? It can avoid wrong use of the parameters. Actually, I'll ask this in Redis repo too.

@nykolaslima
Copy link
Contributor Author

Actually, after we talked, I agree with you! I did remove the checking.

@xetorthio
Copy link
Contributor

So LGTM!

@nykolaslima
Copy link
Contributor Author

Thanks @xetorthio. @HeartSaVioR and @marcosnils what do you think about it?

public void set(final byte[] key, final byte[] value, final byte[] nxxx, final byte[] expx,
final long time) {
sendCommand(Command.SET, key, value, nxxx, expx, toByteArray(time));
public void set(final byte[] key, final byte[] value, final byte[] nxxx, final byte[] expx, final byte[] time) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nykolaslima
Even BinaryClient uses ZParams, so we can change its signature to public void set(final byte[] key, final byte[] value, final SetParams params).
Same things can be applied to BinaryJedis.

@xetorthio @marcosnils What do you think about it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with that.

This way we will be more flexible if *Command*Parameters have any changes. I'll fix it.

@HeartSaVioR HeartSaVioR added this to the 3.0.0 milestone Feb 7, 2015
@HeartSaVioR
Copy link
Contributor

@nykolaslima
Looks like Redis complains Syntax Error. Could you check again?
https://travis-ci.org/xetorthio/jedis/builds/50217281

@marcosnils
Copy link
Contributor

@nykolaslima any updates about this?

@nykolaslima
Copy link
Contributor Author

@marcosnils and @HeartSaVioR sorry about my delay, I'm really busy this week but I'll try to finish it today!

@HeartSaVioR
Copy link
Contributor

@nykolaslima PING

Conflicts:
	src/main/java/redis/clients/jedis/Jedis.java
	src/main/java/redis/clients/jedis/JedisCluster.java
@nykolaslima
Copy link
Contributor Author

@HeartSaVioR @marcosnils @xetorthio Guys, I'm sorry for taking so long on this. I was very busy during these days.

Please, take a look at the PR. Now we got all tests passing. If you have any considerations, please let me know.

By the way, congratulations on the new versions releases 🎉

@HeartSaVioR
Copy link
Contributor

@nykolaslima Well done! When other collaborators take a look and OK then I'll merge.

@HeartSaVioR
Copy link
Contributor

I'm +1, and since any collaborators didn't review this such a long time, it would be good to merge now.

@HeartSaVioR HeartSaVioR merged commit 454f783 into redis:master Aug 4, 2015
@HeartSaVioR
Copy link
Contributor

@nykolaslima Thanks for the great effort! I merged this to master.

@marcosnils
Copy link
Contributor

👍

@nykolaslima nykolaslima deleted the set-with-params branch August 4, 2015 17:34
@nykolaslima
Copy link
Contributor Author

Thank you guys. And i'm sorry for being so away those times..

@HeartSaVioR
Copy link
Contributor

@nykolaslima Not at all! We have many issues to resolve, and I'd be happy if you lend a hand. :)

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

Successfully merging this pull request may close these issues.

Being able to use #set with only expire time
4 participants