Package cz.cvut.kbss.jopa.sessions.cache
Class DisabledCacheManager
java.lang.Object
cz.cvut.kbss.jopa.sessions.cache.DisabledCacheManager
- All Implemented Interfaces:
Cache
,CacheManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(Object identifier, Object entity, Descriptors descriptors) Adds the specified object into the shared session cache.void
close()
Closes the cache.boolean
contains
(Class<?> cls, Object identifier, Descriptor descriptor) Checks whether the cache contains data for the given entity.void
Removes the data for entities of the specified class (and its subclasses) from the cache.void
Removes the data for the given entity from the cache.void
Removes the data for entities of the specified repository context from the cache.void
evictAll()
Clears the cache.void
Removes objects with (possibly) inferred attributes from the cache.<T> T
get
(Class<T> cls, Object identifier, Descriptor descriptor) Gets entity with the specified identifier from the cache.getLoadStateDescriptor
(Object instance) GetsLoadStateDescriptor
that is associated with the specified cached instance.void
setInferredClasses
(Set<Class<?>> inferredClasses) Set the inferred classes for this cache manager.
-
Constructor Details
-
DisabledCacheManager
public DisabledCacheManager()
-
-
Method Details
-
add
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 interfaceCacheManager
- Parameters:
identifier
- Identifier of the specified objectentity
- The object to be added into the cachedescriptors
- Instance descriptors
-
get
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 interfaceCacheManager
- Parameters:
cls
- Class of the entityidentifier
- Primary key of the entitydescriptor
- Instance descriptor, contains info about repository context(s) and language tags- Returns:
- Entity with the specified primary key or
null
-
getLoadStateDescriptor
Description copied from interface:CacheManager
GetsLoadStateDescriptor
that is associated with the specified cached instance.- Specified by:
getLoadStateDescriptor
in interfaceCacheManager
- 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 interfaceCacheManager
-
setInferredClasses
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 interfaceCacheManager
- Parameters:
inferredClasses
- Set of inferred classes
-
close
public void close()Description copied from interface:CacheManager
Closes the cache.- Specified by:
close
in interfaceCacheManager
-
contains
Description copied from interface:Cache
Checks whether the cache contains data for the given entity. -
evict
Description copied from interface:Cache
Removes the data for the given entity from the cache. -
evict
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.
-
evict
Description copied from interface:Cache
Removes the data for entities of the specified repository context from the cache. -
evictAll
public void evictAll()Description copied from interface:Cache
Clears the cache.
-