org.sonatype.aether.util
Class DefaultRepositoryCache
java.lang.Object
org.sonatype.aether.util.DefaultRepositoryCache
- All Implemented Interfaces:
- RepositoryCache
public class DefaultRepositoryCache
- extends java.lang.Object
- implements RepositoryCache
A simplistic repository cache backed by a ConcurrentHashMap
. The simplistic nature of this cache makes it
only suitable for use with short-lived repository system sessions.
- Author:
- Benjamin Bentmann
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultRepositoryCache
public DefaultRepositoryCache()
get
public java.lang.Object get(RepositorySystemSession session,
java.lang.Object key)
- 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 interface RepositoryCache
- Parameters:
session
- The repository session during which the cache is accessed, must not be null
.key
- The key to use for lookup of the data, must not be null
.
- Returns:
- The requested data or
null
if none was present in the cache.
put
public void put(RepositorySystemSession session,
java.lang.Object key,
java.lang.Object data)
- 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 interface RepositoryCache
- Parameters:
session
- The repository session during which the cache is accessed, must not be null
.key
- The key to use for lookup the data with, must not be null
.data
- The data to store in the cache, may be null
.
Copyright © 2010 Sonatype, Inc.. All Rights Reserved.