-
Notifications
You must be signed in to change notification settings - Fork 30
Description
According to the Django documentation, a value of None for the cache timeout should mean that entries in the cache never expire (see https://docs.djangoproject.com/en/5.0/ref/settings/#std-setting-CACHES-TIMEOUT).
Using this appears desirable for wagtail cache, if we use cache invalidation, since there is no reason for a page to be re-rendered every hour/day/month/year/whatever.
However, wagtail cache will just not store anything into the cache if the cache timeout is None:
wagtail-cache/wagtailcache/cache.py
Line 299 in 79638e9
| if timeout: |
There is also an exception in the admin on the cache settings page because the code for formatting the timeout in a human-readable way cannot deal with None-values:
| {% trans "Cached pages are automatically refreshed every" %} <b>{% cache_timeout %}</b>.<br> |
| def seconds_to_readable(seconds: int) -> str: |
It is of course possible to just set the timeout to an arbitrarily high value, but supporting None seems nicer.