-
-
Notifications
You must be signed in to change notification settings - Fork 429
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
Add option flags nx, xx, gt, lt for expire and pexpire #733
base: master
Are you sure you want to change the base?
Add option flags nx, xx, gt, lt for expire and pexpire #733
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #733 +/- ##
========================================
- Coverage 63.3% 62.6% -0.6%
========================================
Files 43 43
Lines 3215 3263 +48
Branches 244 244
========================================
+ Hits 2034 2042 +8
- Misses 1164 1204 +40
Partials 17 17
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@WisdomPill Can you please help. This PR failure is related to some dependency installation or test case? |
No dependency issue, have a look at |
@WisdomPill Could you please review the PR as per your convenience. |
In Progress #730 |
@WisdomPill Could you please review this PR? |
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.
types, tests and linters need to be fixed
@@ -169,19 +169,57 @@ def persist(self, key, version=None, client=None): | |||
|
|||
return super().persist(key=key, version=version, client=client) | |||
|
|||
def expire(self, key, timeout, version=None, client=None): | |||
def expire( |
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.
what about type hints?
cache.set("key1", "value1", timeout=None) | ||
assert cache.expire("key1", 20, nx=True) is True | ||
cache.set("key2", "value2", timeout=20) | ||
assert cache.expire("key2", 21, xx=True) is True | ||
assert cache.expire("key2", 30, gt=True) is True | ||
assert cache.expire("key2", 20, lt=True) is True |
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.
you need to check also ttl after, please add separate tests or use parametrize
cache.set("key1", "value1", timeout=None) | ||
assert cache.pexpire("key1", 20000, nx=True) is True | ||
cache.set("key2", "value2", timeout=20000) | ||
assert cache.expire("key2", 20500, xx=True) is True | ||
assert cache.expire("key2", 30000, gt=True) is True | ||
assert cache.expire("key2", 20000, lt=True) is True |
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.
same as the above
No description provided.