django-redis-cache icon indicating copy to clipboard operation
django-redis-cache copied to clipboard

zero timeout

Open alexryabtsev opened this issue 7 years ago • 2 comments

Hi. I've found some inconsistency in documents.

The documentation says that timeout with None value cache is set indefinitely. And according to the implementation of BaseRedisCache._set method it also works for zero value.

On the other hand, official Django documentation says that: A timeout of 0 won’t cache the value.

Please let me know what do you think about this.

alexryabtsev avatar Apr 25 '17 09:04 alexryabtsev

I agree it's quite confusing to directly contradict the Django docs on this. If you don't intend to change the behavior, there should at least be a very visible notice in the docs or readme.

ZedNaught avatar Jul 01 '17 01:07 ZedNaught

Combine this with the automatic casting of the timeout to int, and you'll have any timeout between 0 and 1 last indefinitely as well. Wasted a couple of hours because of this. https://github.com/niwinz/django-redis seems to work properly in this situation.

bogdanpetrea avatar Dec 15 '18 22:12 bogdanpetrea