File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,3 +137,27 @@ of those items may be deleted.
137137If the delete process is too slow, then you can change this setting to use
138138Django's ``QuerySet._raw_delete `` method. That runs significantly faster than
139139``QuerySet.delete `` but it means that signals are not sent during that process.
140+
141+
142+ WAGTAIL_CACHE_TIMEOUT_JITTER_FUNC
143+ ---------------------------------
144+
145+ .. versionadded ::
146+
147+ An optional function that will be called to adjust the cache timeout each
148+ time a cache item is set. Set to None by default.
149+
150+ This can be used to add a random jitter to the cache timeout to avoid cache
151+ stampedes.
152+
153+ The function should take the timeout as an argument and return a new
154+ timeout. For example, to add a random jitter of up to 10% to the timeout:
155+
156+ .. code-block :: python
157+
158+ import random
159+
160+ def jitter_timeout (timeout ):
161+ return timeout * random.uniform(0.9 , 1.1 )
162+
163+ WAGTAIL_CACHE_TIMEOUT_JITTER_FUNC = jitter_timeout
You can’t perform that action at this time.
0 commit comments