Class Cache
java.lang.Object
org.codehaus.mojo.license.download.Cache
A simple
HashMap
based in-memory cache for storing LicenseDownloader.LicenseDownloadResult
s.- Since:
- 1.18
- Author:
- Peter Palaga
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
hasNormalizedContentChecksum
(String normalizedContentChecksum) If this cache has a normalized version of a license file.void
put
(String url, LicenseDownloader.LicenseDownloadResult entry) Binds the givenurl
to the giveLicenseDownloader.LicenseDownloadResult
.
-
Constructor Details
-
Cache
public Cache(boolean enforcingUniqueSha1s)
-
-
Method Details
-
get
- Parameters:
url
- the cache key to seek- Returns:
- the
LicenseDownloader.LicenseDownloadResult
bound to the givenurl
ornull
if 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 givenurl
to the giveLicenseDownloader.LicenseDownloadResult
. If bothenforcingUniqueSha1s
andLicenseDownloader.LicenseDownloadResult.isSuccess()
aretrue
and 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 givenentry
comes fromentry
- the result of downloading fromurl
-