Class MapBasedBuildCacheService

  • All Implemented Interfaces:, java.lang.AutoCloseable, BuildCacheService

    public class MapBasedBuildCacheService
    extends java.lang.Object
    implements BuildCacheService
    Simple build cache implementation that delegates to a ConcurrentMap.
    • Constructor Summary

      Constructor Description
      MapBasedBuildCacheService​(java.util.concurrent.ConcurrentMap<java.lang.String,​byte[]> delegate)  
    • Constructor Detail

      • MapBasedBuildCacheService

        public MapBasedBuildCacheService​(java.util.concurrent.ConcurrentMap<java.lang.String,​byte[]> delegate)
    • 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. The reader will be called if an entry is found in the cache.
        Specified by:
        load in interface BuildCacheService
        key - the cache key.
        reader - the reader to read the data corresponding to the cache key.
        true if an entry was found, false otherwise.
        BuildCacheException - if the cache fails to load a cache entry for the given key
      • close

        public void close()
        Description copied from interface: BuildCacheService
        Clean up any resources held by the cache once it's not used anymore.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface BuildCacheService
        Specified by:
        close in interface
        Throws: - if the cache fails to close cleanly.