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