Class FileCache
- java.lang.Object
 - 
- com.google.common.cache.AbstractCache<java.lang.String,java.io.File>
 - 
- org.apache.jackrabbit.oak.plugins.blob.FileCache
 
 
 
- 
- All Implemented Interfaces:
 Cache<java.lang.String,java.io.File>,java.io.Closeable,java.lang.AutoCloseable
public class FileCache extends AbstractCache<java.lang.String,java.io.File> implements java.io.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, java.io.File root, CacheLoader<java.lang.String,java.io.InputStream> loader, @Nullable java.util.concurrent.ExecutorService executor)voidclose()booleancontainsKey(java.lang.String key)java.io.Fileget(java.lang.String key)@Nullable java.io.FilegetIfPresent(java.lang.Object key)Returns the value associated withkeyin this cache, ornullif there is no cached value forkey.@Nullable java.io.FilegetIfPresent(java.lang.String key)Retrieves the file handle from the cache if present and null otherwise.DataStoreCacheStatsMBeangetStats()voidinvalidate(java.lang.Object key)Discards any cached value for keykey.voidput(java.lang.String key, java.io.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, java.io.File root, 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 usinggetIfPresent(String).- Specified by:
 putin interfaceCache<java.lang.String,java.io.File>- Overrides:
 putin classAbstractCache<java.lang.String,java.io.File>- Parameters:
 key- of the filefile- 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)
Description copied from interface:CacheReturns the value associated withkeyin this cache, ornullif there is no cached value forkey.- Specified by:
 getIfPresentin interfaceCache<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)
Description copied from interface:CacheDiscards any cached value for keykey.- Specified by:
 invalidatein interfaceCache<java.lang.String,java.io.File>- Overrides:
 invalidatein classAbstractCache<java.lang.String,java.io.File>
 
- 
getStats
public DataStoreCacheStatsMBean getStats()
 
- 
close
public void close()
- Specified by:
 closein interfacejava.lang.AutoCloseable- Specified by:
 closein interfacejava.io.Closeable
 
 - 
 
 -