-
Notifications
You must be signed in to change notification settings - Fork 59
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
Adding support for scan
and flushdb
commands.
#38
Conversation
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.
Thank you so much for the contribution! I only really have one nitpick. If you fix it awesome, if not I will merge and release sometime this week or early next week.
return Response.array(response); | ||
} | ||
|
||
private static Slice extractParameter(List<Slice> params, String name) { |
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.
So I am being a bit nitpicky but I would say rather return an Optional<Slice>
here. This will clean up your consumer calls, i.e. rather than:
Slice matchSlice = extractParameter(params(), MATCH);
String match = matchSlice != null ? matchSlice.toString() : "*";
to
String match = extractParameter(params(), MATCH).orElse("*")
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.
Done! It's a bit more involved as extractParameter
returns Slice
and not String
.
@@ -87,4 +87,32 @@ public static int convertToInteger(String value){ | |||
throw new WrongValueTypeException("ERR bit offset is not an integer or out of range"); | |||
} | |||
} | |||
|
|||
public static String createRegexFromGlob(String glob) |
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.
Definitely belongs here!
Looks like there is only 1 database, so I've made the
flushdb
command perform the same exact operation asflushall
.Resolves #33