Class CacheIndex
- java.lang.Object
-
- net.adoptopenjdk.icedteaweb.resources.cache.CacheIndex
-
class CacheIndex extends java.lang.ObjectIndex of the cached resources.This implementation uses a least recently accessed approach to evict resources when the total size of the cache exceeds the limit.
-
-
Field Summary
Fields Modifier and Type Field Description private CacheIndexFilecacheFile
-
Constructor Summary
Constructors Constructor Description CacheIndex(CacheIndexFile cacheFile)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidclear()Removes all entries.(package private) CacheIndexEntrycreateEntry(CacheKey key, java.lang.String entryId)Create a new entry.(package private) java.util.Set<CacheIndexEntry>findAllEntries(java.net.URL resourceHref)Finds all entries matching the resource independent of their version.(package private) java.util.Set<CacheIndexEntry>findAllEntries(java.net.URL resourceHref, VersionString versionString)Finds all entries matching the resource and version.(package private) java.util.Optional<CacheIndexEntry>findAndMarkAsAccessed(CacheKey key)Finds a single entry and marks it as accessed.(package private) java.util.Optional<CacheIndexEntry>findEntry(CacheKey key)Finds a single entry.(package private) java.util.List<CacheIndexEntry>getAllEntries()private voidmarkAccessed(CacheIndexEntry entry)(package private) voidremoveEntry(CacheIndexEntry entry)Removes an entry from the index.(package private) voidremoveEntry(CacheKey key)Marks the entry for deletion(package private) voidrequestCompression()
-
-
-
Field Detail
-
cacheFile
private final CacheIndexFile cacheFile
-
-
Constructor Detail
-
CacheIndex
CacheIndex(CacheIndexFile cacheFile)
-
-
Method Detail
-
findEntry
java.util.Optional<CacheIndexEntry> findEntry(CacheKey key)
Finds a single entry.- Returns:
- the entry found or
empty, nevernull.
-
findAndMarkAsAccessed
java.util.Optional<CacheIndexEntry> findAndMarkAsAccessed(CacheKey key)
Finds a single entry and marks it as accessed.- Returns:
- the entry found or
empty, nevernull.
-
findAllEntries
java.util.Set<CacheIndexEntry> findAllEntries(java.net.URL resourceHref)
Finds all entries matching the resource independent of their version.- Returns:
- a set of all matching entries, never
null.
-
findAllEntries
java.util.Set<CacheIndexEntry> findAllEntries(java.net.URL resourceHref, VersionString versionString)
Finds all entries matching the resource and version.- Returns:
- a set of all matching entries, never
null.
-
getAllEntries
java.util.List<CacheIndexEntry> getAllEntries()
- Returns:
- all entries
-
createEntry
CacheIndexEntry createEntry(CacheKey key, java.lang.String entryId)
Create a new entry.- Returns:
- the newly created entry
-
removeEntry
void removeEntry(CacheKey key)
Marks the entry for deletion
-
removeEntry
void removeEntry(CacheIndexEntry entry)
Removes an entry from the index.
-
requestCompression
void requestCompression()
-
clear
void clear()
Removes all entries.
-
markAccessed
private void markAccessed(CacheIndexEntry entry)
-
-