Class FileCache
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- org.apache.jackrabbit.guava.common.cache.Cache<String,- File> 
- 
Nested Class SummaryNested classes/interfaces inherited from class org.apache.jackrabbit.guava.common.cache.AbstractCacheorg.apache.jackrabbit.guava.common.cache.AbstractCache.SimpleStatsCounter, org.apache.jackrabbit.guava.common.cache.AbstractCache.StatsCounter
- 
Field SummaryFields
- 
Method SummaryModifier 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.AbstractCacheasMap, cleanUp, get, getAllPresent, invalidateAll, invalidateAll, putAll, size, stats
- 
Field Details- 
DOWNLOAD_DIR- See Also:
 
 
- 
- 
Method Details- 
setMaxEntryCountpublic void setMaxEntryCount(long maxEntryCount) Set the maximum number of files.
- 
getEntryCountpublic long getEntryCount()Get the current entry count (number of files).
- 
buildpublic static FileCache build(long maxSize, File root, org.apache.jackrabbit.guava.common.cache.CacheLoader<String, InputStream> loader, @Nullable @Nullable ExecutorService executor) 
- 
putPuts 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
- 
getIfPresentRetrieves 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
- 
closepublic void close()- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
 
 
-