Interface Cache

All Known Subinterfaces:
CacheManager
All Known Implementing Classes:
DisabledCacheManager, LruCacheManager, TtlCacheManager

public interface Cache
Interface used to interact with the second-level cache.

If a cache is not in use, the methods of this interface have no effect, except for contains, which returns false.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(Class<?> cls, Object identifier, Descriptor descriptor)
    Checks whether the cache contains data for the given entity.
    void
    evict(Class<?> cls)
    Removes the data for entities of the specified class (and its subclasses) from the cache.
    void
    evict(Class<?> cls, Object identifier, URI context)
    Removes the data for the given entity from the cache.
    void
    evict(URI context)
    Removes the data for entities of the specified repository context from the cache.
    void
    Clears the cache.
  • Method Details

    • contains

      boolean contains(Class<?> cls, Object identifier, Descriptor descriptor)
      Checks whether the cache contains data for the given entity.
      Parameters:
      cls - Entity class
      identifier - Instance identifier
      descriptor - Specifies instance context and additional possible information, e.g. language tags
      Returns:
      boolean indicating whether the entity is in the cache
    • evict

      void evict(Class<?> cls, Object identifier, URI context)
      Removes the data for the given entity from the cache.
      Parameters:
      cls - Entity class
      identifier - Instance identifier
      context - Context URI, possibly null, meaning the default context
    • evict

      void evict(Class<?> cls)
      Removes the data for entities of the specified class (and its subclasses) from the cache.

      This method removes the entities from all available contexts.

      Parameters:
      cls - entity class
    • evict

      void evict(URI context)
      Removes the data for entities of the specified repository context from the cache.
      Parameters:
      context - URI of the context to evict, possibly null, meaning the default context
    • evictAll

      void evictAll()
      Clears the cache.