Three thresholds for cache invalidation¶
It’s possible to employ three threshold times to control cache behaviour:
- A time after which the cached item is considered ‘stale’. When a stale item
is returned, an async job is triggered to refresh the item but the stale item
is returned. This is controlled by the
lifetimeattribute of the
Jobclass - the default value is 600 seconds (10 minutes).
- A time after which the cached item is removed (a cache miss). If you have
fetch_on_miss=True, then this will trigger a synchronous data fetch. This is controlled by the
cache_ttlattribute of the
Jobclass - the default value is 2592000 seconds, which is the maximum ttl that memcached supports.
- A timeout value for the refresh job. If the cached item is not refreshed
after this time, then another async refresh job will be triggered. This is
controlled by the
refresh_timeoutattribute of the
Jobclass and defaults to 60 seconds.