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

Draft: Add support for NX, XX, GT and LT to expire and pexpire #762

Conversation

ghost
Copy link

@ghost ghost commented Nov 16, 2024

Fixes #730

@WisdomPill

  • Added support for nx, xx, gt and lt to django_redis/client/default.py and django_redis/client/sharded.py
  • Add tests to tests/test_backend.py

Questions/TODOs [PR marked as draft]:

  • Update changelog
  • Should these flags be supported for expire_at and pexpire_at?
  • A comment on Add option flags nx, xx, gt, lt for expire and pexpire #733 asks to add typing to expire and pexpire functions in django_redis/client/sharded.py. While I can go ahead and add it, the current implementation does not have typing in the function already, is this deliberate?

Copy link

codecov bot commented Nov 16, 2024

Codecov Report

Attention: Patch coverage is 29.66102% with 83 lines in your changes missing coverage. Please review.

Project coverage is 37.9%. Comparing base (6321750) to head (3e1d117).
Report is 11 commits behind head on master.

Files with missing lines Patch % Lines
tests/test_backend.py 35.6% 49 Missing ⚠️
django_redis/client/sharded.py 0.0% 32 Missing ⚠️
django_redis/client/default.py 80.0% 0 Missing and 2 partials ⚠️

❗ There is a different number of reports uploaded between BASE (6321750) and HEAD (3e1d117). Click for more details.

HEAD has 14 uploads less than BASE
Flag BASE (6321750) HEAD (3e1d117)
tests 14 0
Additional details and impacted files
@@            Coverage Diff            @@
##           master    #762      +/-   ##
=========================================
- Coverage    63.2%   37.9%   -25.2%     
=========================================
  Files          43      43              
  Lines        3231    3293      +62     
  Branches      244     244              
=========================================
- Hits         2039    1247     -792     
- Misses       1175    1802     +627     
- Partials       17     244     +227     
Flag Coverage Δ
mypy 37.9% <29.7%> (-<0.1%) ⬇️
tests ?

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.

@ghost ghost marked this pull request as draft November 16, 2024 09:03
@ghost ghost requested a review from WisdomPill November 19, 2024 17:48
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.

approximation needs a higher value for expire and even bigger for pexpire


assert result is expected_result
if expected_ttl is not None:
assert pytest.approx(cache.ttl("foo")) == expected_ttl
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 add a higher tolerance have a look at the docs

@ghost ghost closed this Dec 5, 2024
This pull request was closed.
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.

Add NX, XX, GT and LT to expire and pexpire
1 participant