-
Notifications
You must be signed in to change notification settings - Fork 53
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
Python: adds XADD, XTRIM commands #1320
Conversation
@acarbonetto please sync docs with your PRs |
str(self.threshold), | ||
] | ||
if self.limit is not None: | ||
option_args.extend(["LIMIT", str(self.limit)]) |
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.
Please make LIMIT
, MINID
and other keywords constants
self, | ||
key: str, | ||
values: List[Tuple[str, str]], | ||
options: StreamAddOptions = StreamAddOptions(), |
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.
can you make options optional?
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 am not sure that necessary, since we are giving it a default value
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.
it would be better to set it as optional - we don't need to pass the make_stream value if the user doesn't want to send it.
) | ||
is not None | ||
) | ||
assert await redis_client.custom_command(["XLEN", key]) == 2 |
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.
Add a TODO to replace with XLEN implementation
) | ||
|
||
assert id is not None | ||
assert await redis_client.custom_command(["XLEN", key]) == 2 |
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.
Add TODO to replace with XLEN implementation
threshold (int): Threshold for trimming by maximum length. | ||
limit (Optional[int], optional): Max number of entries to be trimmed. Defaults to None. | ||
""" | ||
super().__init__(exact, threshold, "MAXLEN", limit) |
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.
limit cannot be set when exact is set to true. We should consider a builder that sets either exact OR limit - not both.
threshold (str): Threshold for trimming by minimum ID. | ||
limit (Optional[int], optional): Max number of entries to be trimmed. Defaults to None. | ||
""" | ||
super().__init__(exact, threshold, "MINID", limit) |
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.
limit cannot be set when exact is set to true. We should consider a builder that sets either exact OR limit - not both.
self, | ||
key: str, | ||
values: List[Tuple[str, str]], | ||
options: StreamAddOptions = StreamAddOptions(), |
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.
it would be better to set it as optional - we don't need to pass the make_stream value if the user doesn't want to send it.
16624d3
to
04b8ba3
Compare
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.