Enabled with the system property, "aj.weaving.cache.dir" If this system property is not set, no caching will be performed.
A CRC checksum is stored alongside the class file to verify the bytes on read. If for some reason there is an error reading either the class or crc file, or if the crc does not match the class data the cache entry is deleted.
An alternate implementation of this could store the class file as a jar/zip directly, which would have the required crc; as a first pass however it is somewhat useful to view these files in expanded form for debugging.
| Modifier and Type | Field and Description |
|---|---|
| private final Map | |
| private static final Object |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public void | |
| public static final DefaultFileCacheBacking | |
| public static CacheBacking | |
| protected void | |
| public CachedClassEntry | get(CachedClassReference
entry to retrieve ref, byte[] Pre-weaving class bytes - required in order to
ensure that the cached entry refers to the same original class originalBytes)Implements org. |
| protected Map | getIndex()
Implements abstract org. |
| public String[] | getKeys(final String regex)
Overrides org. Implements org. |
| public void | put(CachedClassEntry
key of the entry entry, byte[] Pre-weaving class bytes - required in order to
ensure that the cached entry refers to the same original class originalBytes)Implements org. |
| protected byte[] | |
| protected Map | |
| public void | remove(CachedClassReference ref)
Implements org. |
| private void | |
| protected AbstractIndexedFileCacheBacking. | |
| protected long | |
| protected void |
| index | back to summary |
|---|---|
| private final Map<String, AbstractIndexedFileCacheBacking. | |
| LOCK | back to summary |
|---|---|
| private static final Object LOCK | |
| DefaultFileCacheBacking | back to summary |
|---|---|
| protected DefaultFileCacheBacking(File cacheDir) | |
| addIndexEntry | back to summary |
|---|---|
| private void addIndexEntry(AbstractIndexedFileCacheBacking. | |
| clear | back to summary |
|---|---|
| public void clear() Implements org. Doc from org. Clear the entire cache | |
| createBacking | back to summary |
|---|---|
| public static final DefaultFileCacheBacking createBacking(File cacheDir) | |
| createBacking | back to summary |
|---|---|
| public static CacheBacking createBacking(String scope) | |
| delete | back to summary |
|---|---|
| protected void delete(File file) Overrides org.
| |
| get | back to summary |
|---|---|
| public CachedClassEntry get(CachedClassReference ref, byte[] originalBytes) Implements org. Doc from org. Get a cache entry
| |
| getIndex | back to summary |
|---|---|
| protected Map Implements abstract org.
| |
| getKeys | back to summary |
|---|---|
| public String[] getKeys(final String regex) Overrides org. Implements org. Doc from org. Return a list of keys which match the given regex.
| |
| put | back to summary |
|---|---|
| public void put(CachedClassEntry entry, byte[] originalBytes) Implements org. Doc from org. Put an entry in the cache
| |
| read | back to summary |
|---|---|
| protected byte[] read(File file, long expectedCRC) | |
| readIndex | back to summary |
|---|---|
| protected Map Overrides org.
| |
| remove | back to summary |
|---|---|
| public void remove(CachedClassReference ref) Implements org. Doc from org. Remove an entry from the cache | |
| removeIndexEntry | back to summary |
|---|---|
| private void removeIndexEntry(String key) | |
| resolveIndexMapEntry | back to summary |
|---|---|
| protected AbstractIndexedFileCacheBacking. Overrides org.
| |
| write | back to summary |
|---|---|
| protected long write(File file, byte[] bytes) | |
| writeIndex | back to summary |
|---|---|
| protected void writeIndex() Overrides org.
| |