Class Cache
java.lang.Object
org.codehaus.mojo.license.download.Cache
A simple
HashMap based in-memory cache for storing LicenseDownloader.LicenseDownloadResults.- Since:
- 1.18
- Author:
- Peter Palaga
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasNormalizedContentChecksum(String normalizedContentChecksum) If this cache has a normalized version of a license file.voidput(String url, LicenseDownloader.LicenseDownloadResult entry) Binds the givenurlto the giveLicenseDownloader.LicenseDownloadResult.
-
Constructor Details
-
Cache
public Cache(boolean enforcingUniqueSha1s)
-
-
Method Details
-
get
- Parameters:
url- the cache key to seek- Returns:
- the
LicenseDownloader.LicenseDownloadResultbound to the givenurlornullif no entry is bound to the givenurl
-
hasNormalizedContentChecksum
If this cache has a normalized version of a license file.- Parameters:
normalizedContentChecksum- Normalized file content checksum.- Returns:
- If the cache has a license file with the same normalized content.
-
put
Binds the givenurlto the giveLicenseDownloader.LicenseDownloadResult. If bothenforcingUniqueSha1sandLicenseDownloader.LicenseDownloadResult.isSuccess()aretrueand an entry with the givenLicenseDownloader.LicenseDownloadResult.getSha1()already exists insha1ToFile, asserts that both the added and the available entry point at the same file.- Parameters:
url- the URL the givenentrycomes fromentry- the result of downloading fromurl
-