Module jtrim.query

Interface CachedLinkContainer<CacheRefType>

Type Parameters:
CacheRefType - the type of the key used to access AsyncDataLink instances in the cache. In case the CachedLinkContainer is being used by an AsyncDataQuery, it can typically be the input used to create the AsyncDataLink.
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.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Removes every AsyncDataLink instances from the cache currently cached by this query.
    boolean
    Removes a cached AsyncDataLink which was cached by the specified input.
  • Method Details

    • clearCache

      Collection<CacheRefType> clearCache()
      Removes every AsyncDataLink instances from the cache currently cached by this query. A subsequent retrieval request from the cache will fail to find any required AsyncDataLink, therefore causing the implementation to fallback to recreate the required AsyncDataLink instance.
      Returns:
      the collection of inputs whose AsyncDataLink instances were cached before calling this method. This method never returns null.
    • removeFromCache

      boolean removeFromCache(CacheRefType arg)
      Removes a cached AsyncDataLink which was cached by the specified input. A subsequent retrieval request from the cache requiring the AsyncDataLink associated with the specified input will fail, therefore causing the implementation to fallback to recreate the required AsyncDataLink instance.
      Parameters:
      arg - the input for which the associated AsyncDataLink is to be removed from the cache. This argument can be null.
      Returns:
      true if an AsyncDataLink instance was cached for the specified input, false otherwise. If this method returns false, it did nothing because there was no AsyncDataLink associated with the given input in the cache.