public interface Cache extends Cache
Provides an API for querying/managing the second level cache regions. <p/> CAUTION: None of these methods respect any isolation or transactional semantics associated with the underlying caches. Specifically, evictions perform an immediate "hard" removal outside any transactions and/or locking scheme(s).
Modifier and Type | Method and Description |
---|---|
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 naturalIdClass)
Evicts all naturalId data from the given region (i.e.
|
void |
evictNaturalIdRegion(String naturalIdName)
Evicts all naturalId data from the given region (i.e.
|
void |
evictNaturalIdRegions()
Evict data from all naturalId regions.
|
void |
evictQueryRegion(String regionName)
Evicts all cached query results under the given name.
|
void |
evictQueryRegions()
Evict data from all query regions.
|
SessionFactory |
getSessionFactory()
Access to the SessionFactory this Cache is bound to.
|
SessionFactory getSessionFactory()
Access to the SessionFactory this Cache is bound to.
boolean containsEntity(Class entityClass, Serializable identifier)
Determine whether the cache contains data for the given entity "instance". <p/> The semantic here is whether the cache contains data visible for the current call context.
entityClass
- The entity class.identifier
- The entity identifierboolean containsEntity(String entityName, Serializable identifier)
Determine whether the cache contains data for the given entity "instance". <p/> The semantic here is whether the cache contains data visible for the current call context.
entityName
- The entity name.identifier
- The entity identifiervoid evictEntity(Class entityClass, Serializable identifier)
Evicts the entity data for a particular entity "instance".
entityClass
- The entity class.identifier
- The entity identifiervoid evictEntity(String entityName, Serializable identifier)
Evicts the entity data for a particular entity "instance".
entityName
- The entity name.identifier
- The entity identifiervoid evictEntityRegion(Class entityClass)
Evicts all entity data from the given region (i.e. for all entities of type).
entityClass
- The entity class.void evictEntityRegion(String entityName)
Evicts all entity data from the given region (i.e. for all entities of type).
entityName
- The entity name.void evictEntityRegions()
Evict data from all entity regions.
void evictNaturalIdRegion(Class naturalIdClass)
Evicts all naturalId data from the given region (i.e. for all entities of type).
naturalIdClass
- The naturalId class.void evictNaturalIdRegion(String naturalIdName)
Evicts all naturalId data from the given region (i.e. for all entities of type).
naturalIdName
- The naturalId name.void evictNaturalIdRegions()
Evict data from all naturalId regions.
boolean containsCollection(String role, Serializable ownerIdentifier)
Determine whether the cache contains data for the given collection. <p/> The semantic here is whether the cache contains data visible for the current call context.
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 entityvoid evictCollection(String role, Serializable ownerIdentifier)
Evicts the cache data for the given identified collection instance.
role
- The "collection role" (in form [owner-entity-name].[collection-property-name]).ownerIdentifier
- The identifier of the owning entityvoid evictCollectionRegion(String role)
Evicts all entity data from the given region (i.e. evicts cached data for all of the specified collection role).
role
- The "collection role" (in form [owner-entity-name].[collection-property-name]).void evictCollectionRegions()
Evict data from all collection regions.
boolean containsQuery(String regionName)
Determine whether the cache contains data for the given query. <p/> The semantic here is whether the cache contains any data for the given region name since query result caches are not transactionally isolated.
regionName
- The cache name given to the query.void evictDefaultQueryRegion()
Evicts all cached query results from the default region.
void evictQueryRegion(String regionName)
Evicts all cached query results under the given name.
regionName
- The cache name associated to the queries being cached.void evictQueryRegions()
Evict data from all query regions.
void evictAllRegions()
Evict all data from the cache.
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.