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

(WIP) Implement hash expiration functions #328

Merged
merged 22 commits into from
Sep 22, 2024

Conversation

j00bar
Copy link
Contributor

@j00bar j00bar commented Sep 21, 2024

Fixes #321

Implements the Redis functions for expiration of hash keys.

@j00bar
Copy link
Contributor Author

j00bar commented Sep 21, 2024

I've not actually tested the functionality of the code or set up a proper test environment for it - was in the middle of that when the work day ended yesterday, so safety not guaranteed.

@cunla
Copy link
Owner

cunla commented Sep 21, 2024

The GitHub workflow should run against different versions of python/redis/redis-py.
But before, please run flake8 and black locally (it should pick up the configuration from pyproject.toml)

@cunla
Copy link
Owner

cunla commented Sep 22, 2024

Hi, I made a few changes to your branch - and now the github workflow is going to test it against redis 7.4 as well.

@cunla
Copy link
Owner

cunla commented Sep 22, 2024

Hi,

I updated the code. Some things to notice:

  • I removed the timedelta/float tests since they are parsed to int in redis-py. Basically, fakeredis implements redis standards which can be found in the documentation (eg, https://redis.io/docs/latest/commands/hexpire/)
  • Notice I implemented _hexpire and _get_expireat as broad implementations and most commands are using them.
  • I updated Hash not to inherit from dict since it caused a few issues.

Next steps:

  • More tests are required, particularly for "bad cases" (multiple flags, key doesn't exist, etc.)
  • Tests for other commands.

@cunla cunla marked this pull request as ready for review September 22, 2024 17:26
@cunla cunla merged commit ce590c9 into cunla:master Sep 22, 2024
1 of 35 checks passed
@j00bar
Copy link
Contributor Author

j00bar commented Sep 23, 2024

Holy crap. You knocked this out. Thank you so much for the fit and finish and getting it done! Deeply grateful.

@cunla
Copy link
Owner

cunla commented Sep 23, 2024

Thank you for contributing.
I will release it with a few other things this weekend.

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.

Support hash key expiration functions
2 participants