public class CacheImpl extends Object implements CacheImplementor
Constructor and Description |
---|
CacheImpl(SessionFactoryImplementor sessionFactory) |
Modifier and Type | Method and Description |
---|---|
void |
addCacheRegion(String name,
Region region)
Add
Region to this Cache scope. |
void |
close()
Close all cache regions.
|
boolean |
containsCollection(String role,
Serializable ownerIdentifier)
Determine whether the cache contains data for the given collection.
|
boolean |
containsEntity(Class entityClass,
Serializable identifier)
Determine whether the cache contains data for the given entity "instance".
|
boolean |
containsEntity(String entityName,
Serializable identifier)
Determine whether the cache contains data for the given entity "instance".
|
boolean |
containsQuery(String regionName)
Determine whether the cache contains data for the given query.
|
void |
evictAllRegions()
Evict all data from the cache.
|
void |
evictCollection(String role,
Serializable ownerIdentifier)
Evicts the cache data for the given identified collection instance.
|
void |
evictCollectionRegion(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(Class entityClass,
Serializable identifier)
Evicts the entity data for a particular entity "instance".
|
void |
evictEntity(String entityName,
Serializable identifier)
Evicts the entity data for a particular entity "instance".
|
void |
evictEntityRegion(Class entityClass)
Evicts all entity data from the given region (i.e.
|
void |
evictEntityRegion(String entityName)
Evicts all entity data from the given region (i.e.
|
void |
evictEntityRegions()
Evict data from all entity regions.
|
void |
evictNaturalIdRegion(Class entityClass)
Evicts all naturalId data from the given region (i.e.
|
void |
evictNaturalIdRegion(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(String regionName)
Evicts all cached query results under the given name.
|
void |
evictQueryRegions()
Evict data from all query regions.
|
Map<String,Region> |
getAllSecondLevelCacheRegions()
Get all cache regions, including query cache.
|
Region |
getNaturalIdCacheRegion(String regionName)
Get natural id cache region by its name.
|
QueryCache |
getQueryCache()
Get the default
QueryCache . |
QueryCache |
getQueryCache(String regionName)
Get query cache by region name or create a new one if none exist.
|
RegionFactory |
getRegionFactory() |
Region |
getSecondLevelCacheRegion(String regionName)
Get second level cache region by its name.
|
UpdateTimestampsCache |
getUpdateTimestampsCache()
Get
UpdateTimestampsCache instance managed by the SessionFactory . |
public CacheImpl(SessionFactoryImplementor sessionFactory)
public boolean containsEntity(Class entityClass, Serializable identifier)
Cache
containsEntity
in interface Cache
entityClass
- The entity class.identifier
- The entity identifierpublic boolean containsEntity(String entityName, Serializable identifier)
Cache
containsEntity
in interface Cache
entityName
- The entity name.identifier
- The entity identifierpublic void evictEntity(Class entityClass, Serializable identifier)
Cache
evictEntity
in interface Cache
entityClass
- The entity class.identifier
- The entity identifierpublic void evictEntity(String entityName, Serializable identifier)
Cache
evictEntity
in interface Cache
entityName
- The entity name.identifier
- The entity identifierpublic void evictEntityRegion(Class entityClass)
Cache
evictEntityRegion
in interface Cache
entityClass
- The entity class.public void evictEntityRegion(String entityName)
Cache
evictEntityRegion
in interface Cache
entityName
- The entity name.public void evictEntityRegions()
Cache
evictEntityRegions
in interface Cache
public void evictNaturalIdRegion(Class entityClass)
Cache
evictNaturalIdRegion
in interface Cache
entityClass
- The naturalId class.public void evictNaturalIdRegion(String entityName)
Cache
evictNaturalIdRegion
in interface Cache
entityName
- The naturalId name.public void evictNaturalIdRegions()
Cache
evictNaturalIdRegions
in interface Cache
public boolean containsCollection(String role, Serializable ownerIdentifier)
Cache
containsCollection
in interface 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(String role, Serializable ownerIdentifier)
Cache
evictCollection
in interface Cache
role
- The "collection role" (in form [owner-entity-name].[collection-property-name]).ownerIdentifier
- The identifier of the owning entitypublic void evictCollectionRegion(String role)
Cache
evictCollectionRegion
in interface Cache
role
- The "collection role" (in form [owner-entity-name].[collection-property-name]).public void evictCollectionRegions()
Cache
evictCollectionRegions
in interface Cache
public boolean containsQuery(String regionName)
Cache
containsQuery
in interface Cache
regionName
- The cache name given to the query.public void evictDefaultQueryRegion()
Cache
evictDefaultQueryRegion
in interface Cache
public void evictQueryRegion(String regionName)
Cache
evictQueryRegion
in interface Cache
regionName
- The cache name associated to the queries being cached.public void evictQueryRegions()
Cache
evictQueryRegions
in interface Cache
public void close()
CacheImplementor
close
in interface CacheImplementor
public QueryCache getQueryCache()
CacheImplementor
QueryCache
.getQueryCache
in interface CacheImplementor
public QueryCache getQueryCache(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 void addCacheRegion(String name, Region region)
CacheImplementor
Region
to this Cache scope.addCacheRegion
in interface CacheImplementor
name
- The region name.region
- The Region
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 Region getSecondLevelCacheRegion(String regionName)
CacheImplementor
getSecondLevelCacheRegion
in interface CacheImplementor
regionName
- The region name.public Region getNaturalIdCacheRegion(String regionName)
CacheImplementor
getNaturalIdCacheRegion
in interface CacheImplementor
regionName
- The region name.public Map<String,Region> getAllSecondLevelCacheRegions()
CacheImplementor
getAllSecondLevelCacheRegions
in interface CacheImplementor
public RegionFactory getRegionFactory()
getRegionFactory
in interface CacheImplementor
RegionFactory
public void evictAllRegions()
Cache
evictAllRegions
in interface Cache
Copyright © 2016 JBoss by Red Hat. All rights reserved.