api / org.gradle.caching

Package org.gradle.caching



interface BuildCacheEntryReader

A reader for build cache entries.


interface BuildCacheEntryWriter

Writer to serialize a build cache entry.


interface BuildCacheKey : Describable

Cache key identifying an entry in the build cache.


interface BuildCacheService : Closeable

Protocol interface to be implemented by a client to a build cache backend.

Build cache implementations should report a non-fatal failure as a BuildCacheException. Non-fatal failures could include failing to retrieve a cache entry or unsuccessfully completing an upload a new cache entry. Gradle will not fail the build when catching a BuildCacheException, but it may disable caching for the build if too many failures occur.

All other failures will be considered fatal and cause the Gradle build to fail. Fatal failures could include failing to read or write cache entries due to file permissions, authentication or corruption errors.

Every build cache implementation should define a org.gradle.caching.configuration.BuildCache configuration and BuildCacheServiceFactory factory.


interface BuildCacheServiceFactory<T : BuildCache>

Factory interface to be provided by build cache service implementations.

To be able to use a BuildCacheService, the factory that implements this interface and the configuration type (BuildCache) must be registered with the org.gradle.caching.configuration.BuildCacheConfiguration.

In settings.gradle:

 buildCache { // Register custom build cache implementation registerBuildCacheService(CustomBuildCache, CustomBuildCacheFactory) remote(CustomBuildCache) { // configure custom build cache. } } 


open class MapBasedBuildCacheService : BuildCacheService

Simple build cache implementation that delegates to a ConcurrentMap.



open class BuildCacheException : GradleException

BuildCacheException is the base class of all exceptions thrown by a BuildCacheService.