Interface MetadataCache<U>

Type Parameters:
U - The metadata type.
All Known Implementing Classes:
AbstractMetadataCache, BatchMetadataCache, DynamicMetadataCache, FetchThroughMetadataCache

public interface MetadataCache<U>
A cache for loading, storing, and retrieving metadata against against the supplied CriteriaSet.

Implementations can choose the specific cache semantics implemented e.g. read-through, refresh-ahead etc. as well as storage/eviction strategies.

Implementations are intended to be access concurrently, and therefore are required to be thread-safe.

  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Clear all entries from the cache.
    get(CriteriaSet criteria)
    Get the list of metadata matching the given identifier.
  • Method Details

    • get

      @Nonnull @NonnullElements List<U> get(@Nonnull @NotEmpty CriteriaSet criteria) throws MetadataCacheException
      Get the list of metadata matching the given identifier.

      The implementing method is required to be thread safe.

      Parameters:
      criteria - the criteria to use when getting the metadata from the cache or the source.
      Returns:
      a list of metadata matching the criteria.
      Throws:
      MetadataCacheException - on error fetching metadata.
    • clearAll

      default boolean clearAll()
      Clear all entries from the cache.

      The default, for implementations that do not override this method, is false: the cache has not been cleared.

      The implementing method is required to be thread safe.

      Returns:
      true if the clear operation completed successfully, false if it failed. Running successfully does not necessarily mean all entries have been removed from the cache; that depends on the cache implementation.
      Since:
      3.4.0 TODO: remove the default in 4.0.0