Kyle McChesney
06/16/2026, 6:28 PMPREFECT_TASKS_DISABLE_CACHING=true fully disable caching, even if the computed key points to an existing result from a previous run?Marvin
06/16/2026, 6:28 PMMarvin
06/16/2026, 6:30 PMPREFECT_TASKS_DISABLE_CACHING=true fully disables task caching.
That means even if:
- your task has a custom cache_key_fn, or
- your task uses a custom cache_policy, and
- that key would match an existing persisted result from a prior run
...Prefect will not reuse that cached result.
Why: when this setting is enabled, Prefect overrides task caching with NO_CACHE, which causes the cache key to be None. Since there is no key, Prefect skips the cache lookup entirely, so previously stored results are not read.
So the practical behavior is:
- no cache key reuse
- no cache reads
- no cache writes
It’s effectively a global caching kill switch for tasks.
Relevant source-backed docs/code path:
- Prefect settings reference for task settings: Task settings reference
- Prefect repository: Prefect source
If you want, I can also show the exact source snippets involved (tasks.py, cache_policies.py, and transaction lookup) in a short annotated example.