Class FileCache
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.jackrabbit.guava.common.cache.Cache<String,File>
-
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic FileCachebuild(long maxSize, File root, org.apache.jackrabbit.guava.common.cache.CacheLoader<String, InputStream> loader, @Nullable ExecutorService executor) voidclose()booleancontainsKey(String key) longGet the current entry count (number of files).@Nullable FilegetIfPresent(Object key) @Nullable FilegetIfPresent(String key) Retrieves the file handle from the cache if present and null otherwise.getStats()voidinvalidate(Object key) voidPuts the given key and file into the cache.voidsetMaxEntryCount(long maxEntryCount) Set the maximum number of files.Methods inherited from class org.apache.jackrabbit.guava.common.cache.AbstractCache
asMap, cleanUp, get, getAllPresent, invalidateAll, invalidateAll, putAll, size, stats
-
Field Details
-
DOWNLOAD_DIR
- See Also:
-
-
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
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
-
getIfPresent
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
-
get
- Throws:
IOException
-
invalidate
-
getStats
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-