Class FileCache

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, org.apache.jackrabbit.guava.common.cache.Cache<java.lang.String,​java.io.File>

    public class FileCache
    extends org.apache.jackrabbit.guava.common.cache.AbstractCache<java.lang.String,​java.io.File>
    implements java.io.Closeable
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.apache.jackrabbit.guava.common.cache.AbstractCache

        org.apache.jackrabbit.guava.common.cache.AbstractCache.SimpleStatsCounter, org.apache.jackrabbit.guava.common.cache.AbstractCache.StatsCounter
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static java.lang.String DOWNLOAD_DIR  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static FileCache build​(long maxSize, java.io.File root, org.apache.jackrabbit.guava.common.cache.CacheLoader<java.lang.String,​java.io.InputStream> loader, @Nullable java.util.concurrent.ExecutorService executor)  
      void close()  
      boolean containsKey​(java.lang.String key)  
      java.io.File get​(java.lang.String key)  
      @Nullable java.io.File getIfPresent​(java.lang.Object key)  
      @Nullable java.io.File getIfPresent​(java.lang.String key)
      Retrieves the file handle from the cache if present and null otherwise.
      DataStoreCacheStatsMBean getStats()  
      void invalidate​(java.lang.Object key)  
      void put​(java.lang.String key, java.io.File file)
      Puts the given key and file into the cache.
      • Methods inherited from class org.apache.jackrabbit.guava.common.cache.AbstractCache

        asMap, cleanUp, get, getAllPresent, invalidateAll, invalidateAll, putAll, size, stats
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • build

        public static FileCache build​(long maxSize,
                                      java.io.File root,
                                      org.apache.jackrabbit.guava.common.cache.CacheLoader<java.lang.String,​java.io.InputStream> loader,
                                      @Nullable
                                      @Nullable java.util.concurrent.ExecutorService executor)
      • put

        public void put​(java.lang.String key,
                        java.io.File file)
        Puts the given key and file into the cache. The file is moved to the cache. So, the original file won't be available after this operation. It can be retrieved using getIfPresent(String).
        Specified by:
        put in interface org.apache.jackrabbit.guava.common.cache.Cache<java.lang.String,​java.io.File>
        Overrides:
        put in class org.apache.jackrabbit.guava.common.cache.AbstractCache<java.lang.String,​java.io.File>
        Parameters:
        key - of the file
        file - to put into cache
      • containsKey

        public boolean containsKey​(java.lang.String key)
      • getIfPresent

        @Nullable
        public @Nullable java.io.File getIfPresent​(java.lang.String key)
        Retrieves the file handle from the cache if present and null otherwise.
        Parameters:
        key - of the file to retrieve
        Returns:
        File handle if available
      • getIfPresent

        @Nullable
        public @Nullable java.io.File getIfPresent​(java.lang.Object key)
        Specified by:
        getIfPresent in interface org.apache.jackrabbit.guava.common.cache.Cache<java.lang.String,​java.io.File>
      • get

        public java.io.File get​(java.lang.String key)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • invalidate

        public void invalidate​(java.lang.Object key)
        Specified by:
        invalidate in interface org.apache.jackrabbit.guava.common.cache.Cache<java.lang.String,​java.io.File>
        Overrides:
        invalidate in class org.apache.jackrabbit.guava.common.cache.AbstractCache<java.lang.String,​java.io.File>
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable