Class Cache
java.lang.Object
net.adoptopenjdk.icedteaweb.resources.cache.Cache
The Cache.
- clear() -> void
- cleanup() -> void
- contains(cacheKey) -> boolean
- isNewerThan(cacheKey, date) -> boolean
- get(cacheKey) -> file
- add(inputStream, downloadInfo) -> void
- bestMatchingVersion(url, versionRange) -> versionId
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FileaddToCache(DownloadInfo infoFromRemote, InputStream unpackedStream) private static voidassertLocationIsCacheable(URL location) static voidThis will remove all old cache items.static booleanClears the cache by deleting all contentstatic voiddeleteFromCache(String cacheId) static voiddeleteFromCache(URL resource, VersionString version) static voiddeleteFromCache(CacheIdInfo cacheId) static voiddeleteFromCache(ResourceInfo info) getAllVersionsInCache(URL resourceHref) static VersionIdgetBestMatchingVersionInCache(URL resource, VersionString version) static FilegetCacheFile(URL resource, VersionId version) Returns the file for the locally cached contents of the resource.private static FilegetCacheFile(CacheKey key) static List<CacheIdInfo> getCacheIds(String filter) This method load all known IDs of applications and will gather all members, which share the idstatic List<CacheIdInfo> This method load all known IDs of applicationsstatic ResourceInfoprivate static ResourceInfostatic List<CacheIdInfo> This method load all known IDs of applicationsstatic voidinvalidateExistingCacheFile(URL resource, VersionId version) Invalidate the entry and make it eligible for removal.private static voidstatic booleanisAnyCached(URL resource, VersionString version) Returns true if the cache has a local copy of the contents of the URL matching the specified version.static booleanReturns whether there is a version of the URL contents in the cache.private static booleanstatic booleanisUpToDate(URL resource, VersionId version, long lastModified) Returns whether there is a version of the URL contents in the cache and it is up to date.private static booleanisUpToDate(CacheKey key, long lastModified)
-
Constructor Details
-
Cache
public Cache()
-
-
Method Details
-
clearCache
public static boolean clearCache()Clears the cache by deleting all contentNote: Because of how our caching system works, deleting jars of another javaws process is using them can be quite disastrous. Hence why Launcher creates lock files and we check for those.
- Returns:
- true if the cache could and was cleared
-
cleanCache
public static void cleanCache()This will remove all old cache items. -
getCacheFile
Returns the file for the locally cached contents of the resource. This method returns the file location only and does not download the resource. The latest version of the resource that matches the specified version will be returned.- Parameters:
resource- the resourceURLversion- the version of the local file- Returns:
- the file location in the cache, or
nullif no versions cached - Throws:
IllegalArgumentException- if the resource is not cacheable
-
getCacheFile
-
addToCache
public static File addToCache(DownloadInfo infoFromRemote, InputStream unpackedStream) throws IOException - Throws:
IOException
-
invalidateExistingCacheFile
Invalidate the entry and make it eligible for removal.- Parameters:
resource- the resourceURLversion- the versions- Throws:
IllegalArgumentException- if the resource is not cacheable
-
invalidateExistingCacheFile
-
deleteFromCache
-
deleteFromCache
-
isCached
Returns whether there is a version of the URL contents in the cache.- Parameters:
resource- the resourceURLversion- the versions to check for- Returns:
- whether the cache contains the version
- Throws:
IllegalArgumentException- if the resource is not cacheable
-
isCached
-
getInfo
-
getInfo
-
isAnyCached
Returns true if the cache has a local copy of the contents of the URL matching the specified version.- Parameters:
resource- the resource URLversion- the version to check for- Returns:
- true if the source is in the cache
- Throws:
IllegalArgumentException- if the source is not cacheable
-
getBestMatchingVersionInCache
-
getAllVersionsInCache
-
isUpToDate
Returns whether there is a version of the URL contents in the cache and it is up to date. This method may not return immediately.- Parameters:
resource- the resourceURLversion- the versions to check forlastModified- time in millis since epoch of last modification- Returns:
- whether the cache contains the version
- Throws:
IllegalArgumentException- if the resource is not cacheable
-
isUpToDate
-
assertLocationIsCacheable
-
getJnlpCacheIds
This method load all known IDs of applications -
getDomainCacheIds
This method load all known IDs of applications -
getCacheIds
This method load all known IDs of applications and will gather all members, which share the id- Parameters:
filter- - regex to filter keys
-
deleteFromCache
-
deleteFromCache
-