gradle
8.2

# doNotCacheIf

abstract fun doNotCacheIf(cachingDisabledReason: String, spec: Spec<out Any>)

Disable caching the results of the task if the given spec is satisfied. The spec will be evaluated at task execution time, not during configuration.

As opposed to cacheIf, this method never enables caching for a task, it can only be used to disable caching.

You may add multiple such predicates. The results of the task are not cached if any of the predicates return `true`, or if any of the predicates passed to cacheIf returns `false`.

#### Parameters

cachingDisabledReason

the reason why caching would be disabled by the spec.

spec

specifies if the results of the task should not be cached.