Class FileCache
- java.lang.Object
-
- com.google.common.cache.AbstractCache<String,File>
-
- org.apache.jackrabbit.oak.plugins.blob.FileCache
-
- All Implemented Interfaces:
Cache<String,File>,Closeable,AutoCloseable
public class FileCache extends AbstractCache<String,File> implements Closeable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.cache.AbstractCache
AbstractCache.SimpleStatsCounter, AbstractCache.StatsCounter
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FileCachebuild(long maxSize, File root, CacheLoader<String,InputStream> loader, @Nullable ExecutorService executor)voidclose()booleancontainsKey(String key)Fileget(String key)@Nullable FilegetIfPresent(Object key)Returns the value associated withkeyin this cache, ornullif there is no cached value forkey.@Nullable FilegetIfPresent(String key)Retrieves the file handle from the cache if present and null otherwise.DataStoreCacheStatsMBeangetStats()voidinvalidate(Object key)Discards any cached value for keykey.voidput(String key, File file)Puts the given key and file into the cache.-
Methods inherited from class com.google.common.cache.AbstractCache
asMap, cleanUp, get, getAllPresent, invalidateAll, invalidateAll, putAll, size, stats
-
-
-
-
Method Detail
-
build
public static FileCache build(long maxSize, File root, 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 usinggetIfPresent(String).
-
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)
Description copied from interface:CacheReturns the value associated withkeyin this cache, ornullif there is no cached value forkey.- Specified by:
getIfPresentin interfaceCache<String,File>
-
get
public File get(String key) throws IOException
- Throws:
IOException
-
invalidate
public void invalidate(Object key)
Description copied from interface:CacheDiscards any cached value for keykey.- Specified by:
invalidatein interfaceCache<String,File>- Overrides:
invalidatein classAbstractCache<String,File>
-
getStats
public DataStoreCacheStatsMBean getStats()
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-