Package org.gradle.caching
Class MapBasedBuildCacheService
- java.lang.Object
-
- org.gradle.caching.MapBasedBuildCacheService
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,BuildCacheService
public class MapBasedBuildCacheService extends java.lang.Object implements BuildCacheService
Simple build cache implementation that delegates to aConcurrentMap
.- Since:
- 3.5
-
-
Constructor Summary
Constructors Constructor Description MapBasedBuildCacheService(java.util.concurrent.ConcurrentMap<java.lang.String,byte[]> delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Clean up any resources held by the cache once it's not used anymore.boolean
load(BuildCacheKey key, BuildCacheEntryReader reader)
Load the cached entry corresponding to the given cache key.void
store(BuildCacheKey key, BuildCacheEntryWriter output)
Store the cache entry with the given cache key.
-
-
-
Method Detail
-
load
public boolean load(BuildCacheKey key, BuildCacheEntryReader reader) throws BuildCacheException
Description copied from interface:BuildCacheService
Load the cached entry corresponding to the given cache key. Thereader
will be called if an entry is found in the cache.- Specified by:
load
in interfaceBuildCacheService
- Parameters:
key
- the cache key.reader
- the reader to read the data corresponding to the cache key.- Returns:
true
if an entry was found,false
otherwise.- Throws:
BuildCacheException
- if the cache fails to load a cache entry for the given key
-
store
public void store(BuildCacheKey key, BuildCacheEntryWriter output) throws BuildCacheException
Description copied from interface:BuildCacheService
Store the cache entry with the given cache key. Thewriter
will be called to actually write the data.- Specified by:
store
in interfaceBuildCacheService
- Parameters:
key
- the cache key.output
- the writer to write the data corresponding to the cache key.- Throws:
BuildCacheException
- if the cache fails to store a cache entry for the given key
-
close
public void close() throws java.io.IOException
Description copied from interface:BuildCacheService
Clean up any resources held by the cache once it's not used anymore.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceBuildCacheService
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
- if the cache fails to close cleanly.
-
-