# BuildCacheService

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.

#### Since

3.5

#### Inheritors

MapBasedBuildCacheService

## Functions

close
Link copied to clipboard
abstract fun close()
Clean up any resources held by the cache once it's not used anymore.
load
Link copied to clipboard
abstract fun load(key: BuildCacheKey, reader: BuildCacheEntryReader): Boolean
Load the cached entry corresponding to the given cache key.
store
Link copied to clipboard
abstract fun store(key: BuildCacheKey, writer: BuildCacheEntryWriter)
Store the cache entry with the given cache key.