Package org.jtrim2.concurrent.query
Interface CachedLinkContainer<CacheRefType>
- Type Parameters:
CacheRefType- the type of the key used to accessAsyncDataLinkinstances in the cache. In case theCachedLinkContaineris being used by anAsyncDataQuery, it can typically be the input used tocreatetheAsyncDataLink.
- All Known Implementing Classes:
CachedAsyncDataQuery,CachedByIDAsyncDataQuery
public interface CachedLinkContainer<CacheRefType>
Defines a container for cached
AsyncDataLink instances.
How AsyncDataLink instances are added to the cache is completely
implementation dependent, this interface only defines methods for removing
AsyncDataLink instances from the cache.
This interface is intended to be used by AsyncDataQuery
implementations caching AsyncDataLink instances.
Thread safety
Implementations of this class must be safe to be used by multiple threads concurrently.Synchronization transparency
Implementations of this interface are not required to be synchronization transparent.-
Method Summary
Modifier and TypeMethodDescriptionRemoves everyAsyncDataLinkinstances from the cache currently cached by this query.booleanRemoves a cachedAsyncDataLinkwhich was cached by the specified input.
-
Method Details
-
clearCache
Collection<CacheRefType> clearCache()Removes everyAsyncDataLinkinstances from the cache currently cached by this query. A subsequent retrieval request from the cache will fail to find any requiredAsyncDataLink, therefore causing the implementation to fallback to recreate the requiredAsyncDataLinkinstance.- Returns:
- the collection of inputs whose
AsyncDataLinkinstances were cached before calling this method. This method never returnsnull.
-
removeFromCache
Removes a cachedAsyncDataLinkwhich was cached by the specified input. A subsequent retrieval request from the cache requiring theAsyncDataLinkassociated with the specified input will fail, therefore causing the implementation to fallback to recreate the requiredAsyncDataLinkinstance.- Parameters:
arg- the input for which the associatedAsyncDataLinkis to be removed from the cache. This argument can benull.- Returns:
trueif anAsyncDataLinkinstance was cached for the specified input,falseotherwise. If this method returnsfalse, it did nothing because there was noAsyncDataLinkassociated with the given input in the cache.
-