public class FileCache extends AbstractCache<String,File> implements Closeable
AbstractCache.SimpleStatsCounter, AbstractCache.StatsCounter| Modifier and Type | Field and Description |
|---|---|
protected static String |
DOWNLOAD_DIR |
| Modifier and Type | Method and Description |
|---|---|
static FileCache |
build(long maxSize,
File root,
CacheLoader<String,InputStream> loader,
@Nullable ExecutorService executor) |
void |
close() |
boolean |
containsKey(String key) |
File |
get(String key) |
@Nullable File |
getIfPresent(Object key) |
@Nullable File |
getIfPresent(String key)
Retrieves the file handle from the cache if present and null otherwise.
|
DataStoreCacheStatsMBean |
getStats() |
void |
invalidate(Object key) |
void |
put(String key,
File file)
Puts the given key and file into the cache.
|
asMap, cleanUp, get, getAllPresent, invalidateAll, invalidateAll, putAll, size, statsprotected static final String DOWNLOAD_DIR
public static FileCache build(long maxSize, File root, CacheLoader<String,InputStream> loader, @Nullable @Nullable ExecutorService executor)
public void put(String key, File file)
getIfPresent(String).public boolean containsKey(String key)
@Nullable public @Nullable File getIfPresent(String key)
key - of the file to retrieve@Nullable public @Nullable File getIfPresent(Object key)
getIfPresent in interface Cache<String,File>public File get(String key) throws IOException
IOExceptionpublic void invalidate(Object key)
invalidate in interface Cache<String,File>invalidate in class AbstractCache<String,File>public DataStoreCacheStatsMBean getStats()
public void close()
close in interface Closeableclose in interface AutoCloseableCopyright © 2012–2019 The Apache Software Foundation. All rights reserved.