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

Add option flags nx, xx, gt, lt for expire and pexpire #733

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

sauravsharma1998
Copy link

No description provided.

Copy link

codecov bot commented Feb 25, 2024

Codecov Report

Attention: Patch coverage is 25.92593% with 40 lines in your changes missing coverage. Please review.

Project coverage is 62.6%. Comparing base (f34935c) to head (c0cc303).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
django_redis/client/sharded.py 12.5% 28 Missing ⚠️
tests/test_backend.py 0.0% 12 Missing ⚠️
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             
Flag Coverage Δ
mypy 37.8% <14.9%> (-0.3%) ⬇️
tests 90.3% <100.0%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sauravsharma1998
Copy link
Author

@WisdomPill Can you please help. This PR failure is related to some dependency installation or test case?

@WisdomPill
Copy link
Member

No dependency issue, have a look at ShardedClient which has .expire() defined which means you have to change ShardedClient as well

@sauravsharma1998
Copy link
Author

@WisdomPill Could you please review the PR as per your convenience.

@sauravsharma1998
Copy link
Author

In Progress #730

@sauravsharma1998
Copy link
Author

@WisdomPill Could you please review this PR?

Copy link
Member

@WisdomPill WisdomPill left a 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(
Copy link
Member

Choose a reason for hiding this comment

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

what about type hints?

Comment on lines +609 to +614
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
Copy link
Member

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

Comment on lines +628 to +633
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
Copy link
Member

Choose a reason for hiding this comment

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

same as the above

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.

None yet

2 participants