Package org.eclipse.aether
Class DefaultRepositoryCache
java.lang.Object
org.eclipse.aether.DefaultRepositoryCache
- All Implemented Interfaces:
RepositoryCache
A simplistic repository cache backed by a thread-safe map. The simplistic nature of this cache makes it only suitable
for use with short-lived repository system sessions where pruning of cache data is not required.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionget
(RepositorySystemSession session, Object key) Gets the specified data from the cache.void
put
(RepositorySystemSession session, Object key, Object data) Puts the specified data into the cache.
-
Constructor Details
-
DefaultRepositoryCache
public DefaultRepositoryCache()
-
-
Method Details
-
get
Description copied from interface:RepositoryCache
Gets the specified data from the cache.Warning: The cache will directly return the saved reference. If the cached data is to be modified after its retrieval, the caller is responsible to create a copy of the returned data and use this instead of the cache record.
- Specified by:
get
in interfaceRepositoryCache
- Parameters:
session
- The repository session during which the cache is accessed, must not benull
.key
- The key to use for lookup of the data, must not benull
.- Returns:
- The requested data or
null
if none was present in the cache.
-
put
Description copied from interface:RepositoryCache
Puts the specified data into the cache. It is entirely up to the cache implementation how long this data will be kept before being purged, i.e. callers must not make any assumptions about the lifetime of cached data.Warning: The cache will directly save the provided reference. If the cached data is mutable, i.e. could be modified after being put into the cache, the caller is responsible for creating a copy of the original data and store the copy in the cache.
- Specified by:
put
in interfaceRepositoryCache
- Parameters:
session
- The repository session during which the cache is accessed, must not benull
.key
- The key to use for lookup of the data, must not benull
.data
- The data to store in the cache, may benull
.
-