<@ULVA73B9P> - if I have tasks that specify a full...
# ask-marvin
k
@Marvin - if I have tasks that specify a fully custom caching function/policy, will setting
PREFECT_TASKS_DISABLE_CACHING=true
fully disable caching, even if the computed key points to an existing result from a previous run?
m
thought for 110.6 seconds
Yes — in Prefect 3.x,
PREFECT_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.