Class CacheIndexHolder


  • class CacheIndexHolder
    extends java.lang.Object
    Holder of the cached LeastRecentlyUsedCacheIndex data. The responsibility of this class is to make sure that access to the content of the LeastRecentlyUsedCacheIndex is synchronized and any changes are written back to the file system.
    • Method Detail

      • runSynchronized

        void runSynchronized​(java.util.function.Consumer<CacheIndex> action)
        Executes the code passed in action in a synchronized fashion to allow exclusive access to the index.
      • getSynchronized

        <T> T getSynchronized​(java.util.function.Function<CacheIndex,​T> action)
        Executes the function passed in action in a synchronized fashion to allow exclusive access to the index.
        Returns:
        the result of the passed function.
      • lockCacheFile

        private CacheIndexFile lockCacheFile()
        Lock the properties file to have exclusive access.
      • unlockCacheFile

        private void unlockCacheFile​(CacheIndexFile cacheFile)
        Unlock the properties file.
      • persistChanges

        private void persistChanges​(CacheIndexFile cacheFile)
        Write file to disk.
      • getCacheFile

        private CacheIndexFile getCacheFile()
        Returns:
        the recentlyUsedPropertiesFile
      • convertOldId

        private java.lang.String convertOldId​(java.lang.String id)