Package org.hibernate.cache.internal
Class DisabledCaching
- java.lang.Object
-
- org.hibernate.cache.internal.DisabledCaching
-
- All Implemented Interfaces:
Cache
,Serializable
,Cache
,CacheImplementor
,Service
public class DisabledCaching extends Object implements CacheImplementor
ACacheImplementor
service used when the second-level cache is disabled.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DisabledCaching(SessionFactoryImplementor sessionFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
close()
Close this "cache", releasing all underlying resources.boolean
contains(Class cls, Object primaryKey)
boolean
containsCollection(String role, Object ownerIdentifier)
Determine whether the cache contains an item for the collection with the given role and given identifier.boolean
containsEntity(Class<?> entityClass, Object identifier)
Determine whether the cache contains an item for the entity of the given type, and with the given identifier.boolean
containsEntity(String entityName, Object identifier)
Determine whether the cache contains an item for the entity of the type with the given name, and with the given identifier.boolean
containsQuery(String regionName)
Determine whether the given region name contains cached query results.void
evict(Class cls)
void
evict(Class cls, Object primaryKey)
void
evictCollectionData()
Evict all cache data from every cache region to which some collection role is assigned.void
evictCollectionData(String role)
Evict all cached data from the cache region to which the given collection role is assigned.void
evictCollectionData(String role, Object ownerIdentifier)
Evict the cached item for the collection with the given role and given identifier, if there is any such item in the cache.void
evictDefaultQueryRegion()
Evict all cached query results from the default region.void
evictEntityData()
Evict all cached data from every cache region to which any entity type is assigned.void
evictEntityData(Class<?> entityClass)
Evict all cached data from the cache region to which the given entity type is assigned.void
evictEntityData(Class<?> entityClass, Object identifier)
Evicts the cached item for the entity of the given type, and with the given identifier, if there is any such item in the cache.void
evictEntityData(String entityName)
Evict all cached data from the cache region to which the given named entity type is assigned.void
evictEntityData(String entityName, Object identifier)
Evict the cached item for the entity of the type with the given name, and with the given identifier, if there is any such item in the cache.void
evictNaturalIdData()
Evict all cached natural id mappings for every entity type.void
evictNaturalIdData(Class<?> entityClass)
Evict all cached natural id mappings for the given entity type.void
evictNaturalIdData(String entityName)
Evict all cached natural id mappings for the entity type with the given name.void
evictQueryRegion(String regionName)
Evict all cached query results from the region with the given name.void
evictQueryRegions()
Evict all cached query results from every region.void
evictRegion(String regionName)
Evict all cached data from the named cache region.Set<String>
getCacheRegionNames()
The unqualified name of all regions.CollectionDataAccess
getCollectionRegionAccess(NavigableRole collectionRole)
Deprecated.QueryResultsCache
getDefaultQueryResultsCache()
Access to the "default" region used to store query results when caching was requested but no region was explicitly named.EntityDataAccess
getEntityRegionAccess(NavigableRole rootEntityName)
Deprecated.NaturalIdDataAccess
getNaturalIdCacheRegionAccessStrategy(NavigableRole rootEntityName)
Deprecated.QueryResultsCache
getQueryResultsCache(String regionName)
Get query cache byregion name
or create a new one if none exist.QueryResultsCache
getQueryResultsCacheStrictly(String regionName)
Get the named QueryResultRegionAccess but not creating one if it does not already exist.Region
getRegion(String fullRegionName)
Get a cache Region by name.RegionFactory
getRegionFactory()
The underlying RegionFactory in use.SessionFactoryImplementor
getSessionFactory()
TheSessionFactory
to which thisCache
belongs.TimestampsCache
getTimestampsCache()
Find the cache data access strategy for Hibernate's timestamps cache.void
prime(Set<DomainDataRegionConfig> cacheRegionConfigs)
An initialization phase allowing the caching provider to prime itself from the passed configs<T> T
unwrap(Class<T> cls)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.Cache
evictAll, evictAllRegions
-
Methods inherited from interface org.hibernate.cache.spi.CacheImplementor
evictQueries
-
-
-
-
Constructor Detail
-
DisabledCaching
public DisabledCaching(SessionFactoryImplementor sessionFactory)
-
-
Method Detail
-
getSessionFactory
public SessionFactoryImplementor getSessionFactory()
Description copied from interface:Cache
TheSessionFactory
to which thisCache
belongs.- Specified by:
getSessionFactory
in interfaceCache
- Specified by:
getSessionFactory
in interfaceCacheImplementor
- Returns:
- The SessionFactory
-
getRegionFactory
public RegionFactory getRegionFactory()
Description copied from interface:CacheImplementor
The underlying RegionFactory in use.- Specified by:
getRegionFactory
in interfaceCacheImplementor
-
prime
public void prime(Set<DomainDataRegionConfig> cacheRegionConfigs)
Description copied from interface:CacheImplementor
An initialization phase allowing the caching provider to prime itself from the passed configs- Specified by:
prime
in interfaceCacheImplementor
-
containsEntity
public boolean containsEntity(Class<?> entityClass, Object identifier)
Description copied from interface:Cache
Determine whether the cache contains an item for the entity of the given type, and with the given identifier.- Specified by:
containsEntity
in interfaceCache
- Parameters:
entityClass
- The entity typeidentifier
- The entity identifier- Returns:
- True if the underlying cache contains corresponding data; false otherwise.
-
containsEntity
public boolean containsEntity(String entityName, Object identifier)
Description copied from interface:Cache
Determine whether the cache contains an item for the entity of the type with the given name, and with the given identifier.- Specified by:
containsEntity
in interfaceCache
- Parameters:
entityName
- The entity nameidentifier
- The entity identifier- Returns:
- True if the underlying cache contains corresponding data; false otherwise.
-
evictEntityData
public void evictEntityData(Class<?> entityClass, Object identifier)
Description copied from interface:Cache
Evicts the cached item for the entity of the given type, and with the given identifier, if there is any such item in the cache.- Specified by:
evictEntityData
in interfaceCache
- Parameters:
entityClass
- The entity typeidentifier
- The entity identifier
-
evictEntityData
public void evictEntityData(String entityName, Object identifier)
Description copied from interface:Cache
Evict the cached item for the entity of the type with the given name, and with the given identifier, if there is any such item in the cache.- Specified by:
evictEntityData
in interfaceCache
- Parameters:
entityName
- The entity nameidentifier
- The entity identifier
-
evictEntityData
public void evictEntityData(Class<?> entityClass)
Description copied from interface:Cache
Evict all cached data from the cache region to which the given entity type is assigned. Thus, every cached item for the given entity type will be evicted, along with any cached items for any other entity type assigned to the same cache region.- Specified by:
evictEntityData
in interfaceCache
- Parameters:
entityClass
- The entity type
-
evictEntityData
public void evictEntityData(String entityName)
Description copied from interface:Cache
Evict all cached data from the cache region to which the given named entity type is assigned. Thus, every cached item for the given entity type will be evicted, along with any cached items for any other entity type assigned to the same cache region.- Specified by:
evictEntityData
in interfaceCache
- Parameters:
entityName
- The entity name
-
evictEntityData
public void evictEntityData()
Description copied from interface:Cache
Evict all cached data from every cache region to which any entity type is assigned.- Specified by:
evictEntityData
in interfaceCache
-
evictNaturalIdData
public void evictNaturalIdData(Class<?> entityClass)
Description copied from interface:Cache
Evict all cached natural id mappings for the given entity type.- Specified by:
evictNaturalIdData
in interfaceCache
- Parameters:
entityClass
- The entity type
-
evictNaturalIdData
public void evictNaturalIdData(String entityName)
Description copied from interface:Cache
Evict all cached natural id mappings for the entity type with the given name.- Specified by:
evictNaturalIdData
in interfaceCache
- Parameters:
entityName
- The entity name
-
evictNaturalIdData
public void evictNaturalIdData()
Description copied from interface:Cache
Evict all cached natural id mappings for every entity type.- Specified by:
evictNaturalIdData
in interfaceCache
-
containsCollection
public boolean containsCollection(String role, Object ownerIdentifier)
Description copied from interface:Cache
Determine whether the cache contains an item for the collection with the given role and given identifier.- Specified by:
containsCollection
in interfaceCache
- Parameters:
role
- The name of the collection role in the formpackage.OwnerEntityName.collectionPropertyName
ownerIdentifier
- The identifier of the owning entity- Returns:
- True if the underlying cache contains corresponding data; false otherwise.
-
evictCollectionData
public void evictCollectionData(String role, Object ownerIdentifier)
Description copied from interface:Cache
Evict the cached item for the collection with the given role and given identifier, if there is any such item in the cache.- Specified by:
evictCollectionData
in interfaceCache
- Parameters:
role
- The name of the collection role in the formpackage.OwnerEntityName.collectionPropertyName
ownerIdentifier
- The identifier of the owning entity
-
evictCollectionData
public void evictCollectionData(String role)
Description copied from interface:Cache
Evict all cached data from the cache region to which the given collection role is assigned.- Specified by:
evictCollectionData
in interfaceCache
- Parameters:
role
- The name of the collection role in the formpackage.OwnerEntityName.collectionPropertyName
-
evictCollectionData
public void evictCollectionData()
Description copied from interface:Cache
Evict all cache data from every cache region to which some collection role is assigned.- Specified by:
evictCollectionData
in interfaceCache
-
containsQuery
public boolean containsQuery(String regionName)
Description copied from interface:Cache
Determine whether the given region name contains cached query results.- Specified by:
containsQuery
in interfaceCache
- Parameters:
regionName
- The name of a cache region to which some query is assigned- Returns:
- True if the underlying cache contains corresponding data; false otherwise.
-
evictDefaultQueryRegion
public void evictDefaultQueryRegion()
Description copied from interface:Cache
Evict all cached query results from the default region.- Specified by:
evictDefaultQueryRegion
in interfaceCache
-
evictQueryRegion
public void evictQueryRegion(String regionName)
Description copied from interface:Cache
Evict all cached query results from the region with the given name.- Specified by:
evictQueryRegion
in interfaceCache
- Parameters:
regionName
- The cache name associated to the queries being cached.
-
evictQueryRegions
public void evictQueryRegions()
Description copied from interface:Cache
Evict all cached query results from every region.- Specified by:
evictQueryRegions
in interfaceCache
-
evictRegion
public void evictRegion(String regionName)
Description copied from interface:Cache
Evict all cached data from the named cache region.- Specified by:
evictRegion
in interfaceCache
-
getRegion
public Region getRegion(String fullRegionName)
Description copied from interface:CacheImplementor
Get a cache Region by name. If there is both aDomainDataRegion
and aQueryResultsRegion
with the specified name, then theDomainDataRegion
will be returned.- Specified by:
getRegion
in interfaceCacheImplementor
-
getTimestampsCache
public TimestampsCache getTimestampsCache()
Description copied from interface:CacheImplementor
Find the cache data access strategy for Hibernate's timestamps cache. Will returnnull
if Hibernate is not configured for query result caching- Specified by:
getTimestampsCache
in interfaceCacheImplementor
-
getDefaultQueryResultsCache
public QueryResultsCache getDefaultQueryResultsCache()
Description copied from interface:CacheImplementor
Access to the "default" region used to store query results when caching was requested but no region was explicitly named. Will returnnull
if Hibernate is not configured for query result caching- Specified by:
getDefaultQueryResultsCache
in interfaceCacheImplementor
-
getQueryResultsCache
public QueryResultsCache getQueryResultsCache(String regionName)
Description copied from interface:CacheImplementor
Get query cache byregion name
or create a new one if none exist. If the region name is null, then default query cache region will be returned. Will returnnull
if Hibernate is not configured for query result caching- Specified by:
getQueryResultsCache
in interfaceCacheImplementor
-
getQueryResultsCacheStrictly
public QueryResultsCache getQueryResultsCacheStrictly(String regionName)
Description copied from interface:CacheImplementor
Get the named QueryResultRegionAccess but not creating one if it does not already exist. This is intended for use by statistics. Will returnnull
if Hibernate is not configured for query result caching or if no such region (yet) exists- Specified by:
getQueryResultsCacheStrictly
in interfaceCacheImplementor
-
close
public void close()
Description copied from interface:CacheImplementor
Close this "cache", releasing all underlying resources.- Specified by:
close
in interfaceCacheImplementor
-
getCacheRegionNames
public Set<String> getCacheRegionNames()
Description copied from interface:CacheImplementor
The unqualified name of all regions. Intended for use withCacheImplementor.getRegion(java.lang.String)
- Specified by:
getCacheRegionNames
in interfaceCacheImplementor
-
getEntityRegionAccess
@Deprecated public EntityDataAccess getEntityRegionAccess(NavigableRole rootEntityName)
Deprecated.Description copied from interface:CacheImplementor
Find the cache data access strategy for an entity. Will returnnull
when the entity is not configured for caching.- Specified by:
getEntityRegionAccess
in interfaceCacheImplementor
- Parameters:
rootEntityName
- The NavigableRole representation of the root entity
-
getNaturalIdCacheRegionAccessStrategy
@Deprecated public NaturalIdDataAccess getNaturalIdCacheRegionAccessStrategy(NavigableRole rootEntityName)
Deprecated.Description copied from interface:CacheImplementor
Find the cache data access strategy for the given entity's natural-id cache. Will returnnull
when the entity does not define a natural-id, or its natural-id is not configured for caching.- Specified by:
getNaturalIdCacheRegionAccessStrategy
in interfaceCacheImplementor
- Parameters:
rootEntityName
- The NavigableRole representation of the root entity
-
getCollectionRegionAccess
@Deprecated public CollectionDataAccess getCollectionRegionAccess(NavigableRole collectionRole)
Deprecated.Description copied from interface:CacheImplementor
Find the cache data access strategy for the given collection. Will returnnull
when the collection is not configured for caching.- Specified by:
getCollectionRegionAccess
in interfaceCacheImplementor
-
-