public class CacheImpl extends java.lang.Object implements CacheImplementor
Constructor and Description |
---|
CacheImpl(SessionFactoryImplementor sessionFactory) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close all cache regions.
|
boolean |
contains(java.lang.Class cls,
java.lang.Object primaryKey) |
boolean |
containsCollection(java.lang.String role,
java.io.Serializable ownerIdentifier)
Determine whether the cache contains data for the given collection.
|
boolean |
containsEntity(java.lang.Class entityClass,
java.io.Serializable identifier)
Determine whether the cache contains data for the given entity "instance".
|
boolean |
containsEntity(java.lang.String entityName,
java.io.Serializable identifier)
Determine whether the cache contains data for the given entity "instance".
|
boolean |
containsQuery(java.lang.String regionName)
Determine whether the cache contains data for the given query.
|
CollectionRegionAccessStrategy |
determineCollectionRegionAccessStrategy(Collection model) |
EntityRegionAccessStrategy |
determineEntityRegionAccessStrategy(PersistentClass model) |
NaturalIdRegionAccessStrategy |
determineNaturalIdRegionAccessStrategy(PersistentClass model) |
void |
evict(java.lang.Class cls) |
void |
evict(java.lang.Class cls,
java.lang.Object primaryKey) |
void |
evictAll() |
void |
evictAllRegions()
Evict all data from the cache.
|
void |
evictCollection(java.lang.String role,
java.io.Serializable ownerIdentifier)
Evicts the cache data for the given identified collection instance.
|
void |
evictCollectionRegion(java.lang.String role)
Evicts all entity data from the given region (i.e.
|
void |
evictCollectionRegions()
Evict data from all collection regions.
|
void |
evictDefaultQueryRegion()
Evicts all cached query results from the default region.
|
void |
evictEntity(java.lang.Class entityClass,
java.io.Serializable identifier)
Evicts the entity data for a particular entity "instance".
|
void |
evictEntity(java.lang.String entityName,
java.io.Serializable identifier)
Evicts the entity data for a particular entity "instance".
|
void |
evictEntityRegion(java.lang.Class entityClass)
Evicts all entity data from the given region (i.e.
|
void |
evictEntityRegion(java.lang.String entityName)
Evicts all entity data from the given region (i.e.
|
void |
evictEntityRegions()
Evict data from all entity regions.
|
void |
evictNaturalIdRegion(java.lang.Class entityClass)
Evicts all naturalId data from the given region (i.e.
|
void |
evictNaturalIdRegion(java.lang.String entityName)
Evicts all naturalId data from the given region (i.e.
|
void |
evictNaturalIdRegions()
Evict data from all naturalId regions.
|
void |
evictQueries()
Clean up the default
QueryCache . |
void |
evictQueryRegion(java.lang.String regionName)
Evicts all cached query results under the given name.
|
void |
evictQueryRegions()
Evict data from all query regions.
|
CollectionRegionAccessStrategy |
getCollectionRegionAccess(java.lang.String regionName)
Find the "access strategy" for the named collection cache region.
|
QueryCache |
getDefaultQueryCache()
Get the default
QueryCache . |
EntityRegionAccessStrategy |
getEntityRegionAccess(java.lang.String regionName)
Find the "access strategy" for the named entity cache region.
|
NaturalIdRegionAccessStrategy |
getNaturalIdCacheRegionAccessStrategy(java.lang.String regionName)
Find the "access strategy" for the named natrual-id cache region.
|
QueryCache |
getQueryCache(java.lang.String regionName)
Get query cache by region name or create a new one if none exist.
|
RegionFactory |
getRegionFactory()
The underlying RegionFactory in use.
|
java.lang.String[] |
getSecondLevelCacheRegionNames()
Get the names of all cache regions, including entity, collection, natural-id and query caches.
|
SessionFactory |
getSessionFactory()
Access to the SessionFactory this Cache is bound to.
|
UpdateTimestampsCache |
getUpdateTimestampsCache()
Get
UpdateTimestampsCache instance managed by the SessionFactory . |
java.lang.String |
qualifyRegionName(java.lang.String regionName)
Applies any defined prefix, handling all
null checks. |
<T> T |
unwrap(java.lang.Class<T> cls) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getQueryCache
public CacheImpl(SessionFactoryImplementor sessionFactory)
public SessionFactory getSessionFactory()
Cache
public RegionFactory getRegionFactory()
CacheImplementor
getRegionFactory
in interface CacheImplementor
RegionFactory
public java.lang.String qualifyRegionName(java.lang.String regionName)
CacheImplementor
null
checks.qualifyRegionName
in interface CacheImplementor
regionName
- The region name to qualifypublic boolean containsEntity(java.lang.Class entityClass, java.io.Serializable identifier)
Cache
entityClass
- The entity class.identifier
- The entity identifierpublic boolean containsEntity(java.lang.String entityName, java.io.Serializable identifier)
Cache
entityName
- The entity name.identifier
- The entity identifierpublic void evictEntity(java.lang.Class entityClass, java.io.Serializable identifier)
Cache
entityClass
- The entity class.identifier
- The entity identifierpublic void evictEntity(java.lang.String entityName, java.io.Serializable identifier)
Cache
entityName
- The entity name.identifier
- The entity identifierpublic void evictEntityRegion(java.lang.Class entityClass)
Cache
entityClass
- The entity class.public void evictEntityRegion(java.lang.String entityName)
Cache
entityName
- The entity name.public void evictEntityRegions()
Cache
public void evictNaturalIdRegion(java.lang.Class entityClass)
Cache
entityClass
- The naturalId class.public void evictNaturalIdRegion(java.lang.String entityName)
Cache
entityName
- The naturalId name.public void evictNaturalIdRegions()
Cache
public boolean containsCollection(java.lang.String role, java.io.Serializable ownerIdentifier)
Cache
role
- The name of the collection role (in form
[owner-entity-name].[collection-property-name]) whose regions should be
evicted.ownerIdentifier
- The identifier of the owning entitypublic void evictCollection(java.lang.String role, java.io.Serializable ownerIdentifier)
Cache
role
- The "collection role" (in form [owner-entity-name].[collection-property-name]).ownerIdentifier
- The identifier of the owning entitypublic void evictCollectionRegion(java.lang.String role)
Cache
role
- The "collection role" (in form [owner-entity-name].[collection-property-name]).public void evictCollectionRegions()
Cache
public boolean containsQuery(java.lang.String regionName)
Cache
regionName
- The cache name given to the query.public void evictDefaultQueryRegion()
Cache
public void evictQueryRegion(java.lang.String regionName)
Cache
regionName
- The cache name associated to the queries being cached.public void evictQueryRegions()
Cache
public void close()
CacheImplementor
close
in interface CacheImplementor
public QueryCache getDefaultQueryCache()
CacheImplementor
QueryCache
.getDefaultQueryCache
in interface CacheImplementor
public QueryCache getQueryCache(java.lang.String regionName) throws HibernateException
CacheImplementor
getQueryCache
in interface CacheImplementor
regionName
- Query cache region name.QueryCache
associated with the region name, or default query cache if the region name is null.HibernateException
- HibernateException
maybe thrown when the creation of new QueryCache instance.public UpdateTimestampsCache getUpdateTimestampsCache()
CacheImplementor
UpdateTimestampsCache
instance managed by the SessionFactory
.getUpdateTimestampsCache
in interface CacheImplementor
public void evictQueries() throws HibernateException
CacheImplementor
QueryCache
.evictQueries
in interface CacheImplementor
HibernateException
public java.lang.String[] getSecondLevelCacheRegionNames()
CacheImplementor
getSecondLevelCacheRegionNames
in interface CacheImplementor
public EntityRegionAccessStrategy getEntityRegionAccess(java.lang.String regionName)
CacheImplementor
getEntityRegionAccess
in interface CacheImplementor
regionName
- The name of the regionpublic CollectionRegionAccessStrategy getCollectionRegionAccess(java.lang.String regionName)
CacheImplementor
getCollectionRegionAccess
in interface CacheImplementor
regionName
- The name of the regionpublic NaturalIdRegionAccessStrategy getNaturalIdCacheRegionAccessStrategy(java.lang.String regionName)
CacheImplementor
getNaturalIdCacheRegionAccessStrategy
in interface CacheImplementor
regionName
- The name of the regionpublic void evictAllRegions()
Cache
public boolean contains(java.lang.Class cls, java.lang.Object primaryKey)
contains
in interface javax.persistence.Cache
public void evict(java.lang.Class cls, java.lang.Object primaryKey)
evict
in interface javax.persistence.Cache
public void evict(java.lang.Class cls)
evict
in interface javax.persistence.Cache
public void evictAll()
evictAll
in interface javax.persistence.Cache
public <T> T unwrap(java.lang.Class<T> cls)
unwrap
in interface javax.persistence.Cache
public EntityRegionAccessStrategy determineEntityRegionAccessStrategy(PersistentClass model)
determineEntityRegionAccessStrategy
in interface CacheImplementor
public NaturalIdRegionAccessStrategy determineNaturalIdRegionAccessStrategy(PersistentClass model)
determineNaturalIdRegionAccessStrategy
in interface CacheImplementor
public CollectionRegionAccessStrategy determineCollectionRegionAccessStrategy(Collection model)
determineCollectionRegionAccessStrategy
in interface CacheImplementor
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.