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
Providing negative value for RedisCache.set() throws an exception #1306
Comments
The problem with this is is broadens the semantics of the argument. If for some reason we give another meaning to |
BTW, we are going to remove contrib.cache from werkzeug. See #1249 |
This was a result of a bug in my code where I calculated the expiry by diffing I still think setting any negative value should be treated specially, not just -1:
This allows you to later use other negative values. But again, I debate -1 is the correct “special value” here, although I can’t come up with a better one. |
When I provide a negative timeout to
RedisCache.set()
(except the exact value of-1
,) theredis
library throws an exception:The exact value of
-1
(which is also returned byself._normalize_timeout
if the timeout value isNone
) is handled correctly; in this case, no timeout is set.I think if the provided timeout value is negative,
RedisCache
(and for that matter, any cache backend) should not cache the value at all (and maybe issue a warning).I’m using Werkzeug 0.14.1, but the same issue is also present on master.
The text was updated successfully, but these errors were encountered: