public class DefaultFileCacheBacking extends AbstractIndexedFileCacheBacking
AbstractIndexedFileCacheBacking.IndexEntry
EMPTY_INDEX, EMPTY_KEYS, INDEX_FILE
WEAVED_CLASS_CACHE_DIR
logger
Modifier | Constructor and Description |
---|---|
protected |
DefaultFileCacheBacking(java.io.File cacheDir) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the entire cache
|
static DefaultFileCacheBacking |
createBacking(java.io.File cacheDir) |
static CacheBacking |
createBacking(java.lang.String scope) |
protected void |
delete(java.io.File file) |
CachedClassEntry |
get(CachedClassReference ref,
byte[] originalBytes)
Get a cache entry
|
protected java.util.Map<java.lang.String,AbstractIndexedFileCacheBacking.IndexEntry> |
getIndex() |
java.lang.String[] |
getKeys(java.lang.String regex)
Return a list of keys which match the given
regex.
|
void |
put(CachedClassEntry entry,
byte[] originalBytes)
Put an entry in the cache
|
protected byte[] |
read(java.io.File file,
long expectedCRC) |
protected java.util.Map<java.lang.String,AbstractIndexedFileCacheBacking.IndexEntry> |
readIndex() |
void |
remove(CachedClassReference ref)
Remove an entry from the cache
|
protected AbstractIndexedFileCacheBacking.IndexEntry |
resolveIndexMapEntry(java.io.File cacheDir,
AbstractIndexedFileCacheBacking.IndexEntry ie) |
protected long |
write(java.io.File file,
byte[] bytes) |
protected void |
writeIndex() |
createIndexEntry, getIndexFile, readIndex, readIndex, writeIndex, writeIndex, writeIndex, writeIndex
close, close, getCacheDirectory, writeClassBytes
crc
public static final DefaultFileCacheBacking createBacking(java.io.File cacheDir)
protected java.util.Map<java.lang.String,AbstractIndexedFileCacheBacking.IndexEntry> getIndex()
getIndex
in class AbstractIndexedFileCacheBacking
protected AbstractIndexedFileCacheBacking.IndexEntry resolveIndexMapEntry(java.io.File cacheDir, AbstractIndexedFileCacheBacking.IndexEntry ie)
resolveIndexMapEntry
in class AbstractIndexedFileCacheBacking
protected java.util.Map<java.lang.String,AbstractIndexedFileCacheBacking.IndexEntry> readIndex()
readIndex
in class AbstractIndexedFileCacheBacking
protected void writeIndex()
writeIndex
in class AbstractIndexedFileCacheBacking
public void clear()
CacheBacking
public static CacheBacking createBacking(java.lang.String scope)
public java.lang.String[] getKeys(java.lang.String regex)
CacheBacking
getKeys
in interface CacheBacking
getKeys
in class AbstractIndexedFileCacheBacking
public CachedClassEntry get(CachedClassReference ref, byte[] originalBytes)
CacheBacking
ref
- entry to retrieveoriginalBytes
- Pre-weaving class bytes - required in order to
ensure that the cached entry refers to the same original classpublic void put(CachedClassEntry entry, byte[] originalBytes)
CacheBacking
entry
- key of the entryoriginalBytes
- Pre-weaving class bytes - required in order to
ensure that the cached entry refers to the same original classpublic void remove(CachedClassReference ref)
CacheBacking
protected void delete(java.io.File file)
delete
in class AbstractFileCacheBacking
protected byte[] read(java.io.File file, long expectedCRC)
protected long write(java.io.File file, byte[] bytes)