Class LocalCache


  • public class LocalCache
    extends Object
    This class implements a LRU cache used by CachingDataStore. If cache size exceeds limit, this cache goes in purge mode. In purge mode any operation to cache is no-op. After purge cache size would be less than cachePurgeResizeFactor * maximum size.
    • Constructor Detail

      • LocalCache

        public LocalCache​(String path,
                          String tmpPath,
                          long maxSizeInBytes,
                          double cachePurgeTrigFactor,
                          double cachePurgeResizeFactor,
                          AsyncUploadCache asyncUploadCache)
        Build LRU cache of files located at 'path'. It uses lastModified property of file to build LRU cache. If cache size exceeds limit size, this cache goes in purge mode. In purge mode any operation to cache is no-op.
        Parameters:
        path - file system path
        tmpPath - temporary directory used by cache.
        maxSizeInBytes - maximum size of cache.
        cachePurgeTrigFactor - factor which triggers cache to purge mode. That is if current size exceed (cachePurgeTrigFactor * maxSizeInBytes), the cache will go in auto-purge mode.
        cachePurgeResizeFactor - after cache purge size of cache will be just less (cachePurgeResizeFactor * maxSizeInBytes).
        asyncUploadCache - AsyncUploadCache