Class DisabledCacheManager

java.lang.Object
cz.cvut.kbss.jopa.sessions.cache.DisabledCacheManager
All Implemented Interfaces:
Cache, CacheManager

public class DisabledCacheManager extends Object implements CacheManager
  • Constructor Details

    • DisabledCacheManager

      public DisabledCacheManager()
  • Method Details

    • add

      public void add(Object identifier, Object entity, Descriptors descriptors)
      Description copied from interface: CacheManager
      Adds the specified object into the shared session cache.

      If the cache already contains object with the specified identifier (and it is in the same repository context), it is replaced with the one passed as argument.

      Specified by:
      add in interface CacheManager
      Parameters:
      identifier - Identifier of the specified object
      entity - The object to be added into the cache
      descriptors - Instance descriptors
    • get

      public <T> T get(Class<T> cls, Object identifier, Descriptor descriptor)
      Description copied from interface: CacheManager
      Gets entity with the specified identifier from the cache.

      The entity is searched for in the context specified by descriptor. Thus all three conditions - class, identifier and descriptor must match to return a result.

      Specified by:
      get in interface CacheManager
      Parameters:
      cls - Class of the entity
      identifier - Primary key of the entity
      descriptor - Instance descriptor, contains info about repository context(s) and language tags
      Returns:
      Entity with the specified primary key or null
    • getLoadStateDescriptor

      public LoadStateDescriptor<?> getLoadStateDescriptor(Object instance)
      Description copied from interface: CacheManager
      Gets LoadStateDescriptor that is associated with the specified cached instance.
      Specified by:
      getLoadStateDescriptor in interface CacheManager
      Parameters:
      instance - Instance whose load state descriptor to retrieve
      Returns:
      Load state descriptor, null if this cache does not contain the specified instance
    • evictInferredObjects

      public void evictInferredObjects()
      Description copied from interface: CacheManager
      Removes objects with (possibly) inferred attributes from the cache.

      This should be called when changes in the ontology may influence inference results.

      Specified by:
      evictInferredObjects in interface CacheManager
    • setInferredClasses

      public void setInferredClasses(Set<Class<?>> inferredClasses)
      Description copied from interface: CacheManager
      Set the inferred classes for this cache manager.

      Entities from inferred classes are special in that when anything in the ontology changes, they have to be evicted from the cache, since they are reasoned and their attributes may change.

      Specified by:
      setInferredClasses in interface CacheManager
      Parameters:
      inferredClasses - Set of inferred classes
    • close

      public void close()
      Description copied from interface: CacheManager
      Closes the cache.
      Specified by:
      close in interface CacheManager
    • contains

      public boolean contains(Class<?> cls, Object identifier, Descriptor descriptor)
      Description copied from interface: Cache
      Checks whether the cache contains data for the given entity.
      Specified by:
      contains in interface Cache
      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

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

      public void evict(Class<?> cls)
      Description copied from interface: Cache
      Removes the data for entities of the specified class (and its subclasses) from the cache.

      This method removes the entities from all available contexts.

      Specified by:
      evict in interface Cache
      Parameters:
      cls - entity class
    • evict

      public void evict(URI contextUri)
      Description copied from interface: Cache
      Removes the data for entities of the specified repository context from the cache.
      Specified by:
      evict in interface Cache
      Parameters:
      contextUri - URI of the context to evict, possibly null, meaning the default context
    • evictAll

      public void evictAll()
      Description copied from interface: Cache
      Clears the cache.
      Specified by:
      evictAll in interface Cache