-
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
refactoring set command to use SetParams for the optional parameters #878
Merged
Merged
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
351e749
refactoring set command to use SetParams for the optional parameters
nykolaslima ab38239
fixing compatibility problems with < 1.7
nykolaslima d4131a0
removing parameters checking
nykolaslima 361bcbf
passing Params to binary layer
nykolaslima 69ba3fa
fixing getByteParams, Redis depends on parameters order. Adding javadoc
nykolaslima 6e2706b
fixing parameters order
nykolaslima 157a8ce
Merge branch 'master' into set-with-params
nykolaslima f49eb68
fixing merge problem
nykolaslima 4de7095
fixing wrong test
nykolaslima 454f783
fixing missing key and value params
nykolaslima File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package redis.clients.jedis.params; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public abstract class Params { | ||
|
||
private Map<String, Object> params; | ||
|
||
@SuppressWarnings("unchecked") | ||
public <T> T getParam(String name) { | ||
if(params == null) return null; | ||
|
||
return (T) params.get(name); | ||
} | ||
|
||
public boolean contains(String name) { | ||
if(params == null) return false; | ||
|
||
return params.containsKey(name); | ||
} | ||
|
||
protected void addParam(String name, Object value) { | ||
if(params == null) { | ||
params = new HashMap<String, Object>(); | ||
} | ||
params.put(name, value); | ||
} | ||
|
||
protected void addParam(String name) { | ||
if(params == null) { | ||
params = new HashMap<String, Object>(); | ||
} | ||
params.put(name, true); | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.