Answer the question
In order to leave comments, you need to log in
Django - Does the cache timeout count after the last hit or after it's been set?
from django.core.cache import caches, DEFAULT_CACHE_ALIAS
cache = caches[DEFAULT_CACHE_ALIAS]
cache.set(cache_key, data, timeout)
data = cache.get(cache_key)
Answer the question
In order to leave comments, you need to log in
Time to live after installation
https://docs.djangoproject.com/en/dev/topics/cache...
The timeout argument is optional and defaults to the timeout argument of the appropriate backend in the CACHES setting (explained above). It's the number of seconds the value should be stored in the cache.
Of course, 300 seconds after installation.
After the last appeal - some kind of nonsense. Are you saying that if I go to the cache every 299 seconds, I can keep the value of the key indefinitely? But what about invalidation, cache fading? And how do you control such a cache?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question