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

Allow redis to set expires with an int arg #269

Merged
merged 2 commits into from
Nov 30, 2021
Merged

Allow redis to set expires with an int arg #269

merged 2 commits into from
Nov 30, 2021

Conversation

davegaeddert
Copy link
Contributor

It seems like there are at least a couple scenarios in controller.py where the expires can be an int instead of a datetime.

https://github.com/ionrock/cachecontrol/blob/3bd694551d28445723c18f4ad8c44bce55ff9b5f/cachecontrol/controller.py#L325
https://github.com/ionrock/cachecontrol/blob/3bd694551d28445723c18f4ad8c44bce55ff9b5f/cachecontrol/controller.py#L349

With the way that works currently, I think some check needs to be done in RedisCache to see what type we're working with... the other solution that comes to mind is that expires should only be an int or a datetime? That would be a more involved change but I'd be willing to put some time into it @ionrock if you prefer it goes that direction. Implementing mypy or something might help sort out that kind of bug.

Fixes #268

@davegaeddert
Copy link
Contributor Author

#251 (documentation around expires value) is also related to this.

@ionrock
Copy link
Contributor

ionrock commented Nov 30, 2021

@davegaeddert I think you're right about normalizing how we treat dates, but I also don't have a good idea of a direction to take. The ints seem better to work with overtime, but I could be convinced otherwise. If you're interested in trying to normalize things, I'd be grateful, but this change looks like a good start. Thanks!

@ionrock ionrock merged commit 7815847 into psf:master Nov 30, 2021
@davegaeddert
Copy link
Contributor Author

Sounds good, thanks for merging it!

I'm not sure I know enough to push on normalizing... from some other issues it sounds like people also use custom cache backends and I'm not sure how to best navigate that.

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.

Error when max-age is set
2 participants