Class FileCache

java.lang.Object
org.apache.jackrabbit.guava.common.cache.AbstractCache<String,File>
org.apache.jackrabbit.oak.plugins.blob.FileCache
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.jackrabbit.guava.common.cache.Cache<String,File>

public class FileCache extends org.apache.jackrabbit.guava.common.cache.AbstractCache<String,File> implements Closeable
  • Field Details

  • Method Details

    • setMaxEntryCount

      public void setMaxEntryCount(long maxEntryCount)
      Set the maximum number of files.
    • getEntryCount

      public long getEntryCount()
      Get the current entry count (number of files).
    • build

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

      public void put(String key, 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<String,File>
      Overrides:
      put in class org.apache.jackrabbit.guava.common.cache.AbstractCache<String,File>
      Parameters:
      key - of the file
      file - to put into cache
    • containsKey

      public boolean containsKey(String key)
    • getIfPresent

      @Nullable public @Nullable File getIfPresent(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 File getIfPresent(Object key)
      Specified by:
      getIfPresent in interface org.apache.jackrabbit.guava.common.cache.Cache<String,File>
    • get

      public File get(String key) throws IOException
      Throws:
      IOException
    • invalidate

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

      public DataStoreCacheStatsMBean getStats()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable