Package org.hibernate
Interface Cache
public interface Cache
Provides an API for querying/managing the second level cache regions.
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).
-
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsCollection(String role, Serializable ownerIdentifier) Determine whether the cache contains data for the given collection.booleancontainsEntity(Class entityClass, Serializable identifier) Determine whether the cache contains data for the given entity "instance".booleancontainsEntity(String entityName, Serializable identifier) Determine whether the cache contains data for the given entity "instance".booleancontainsQuery(String regionName) Determine whether the cache contains data for the given query.voidevictCollection(String role, Serializable ownerIdentifier) Evicts the cache data for the given identified collection instance.voidevictCollectionRegion(String role) Evicts all entity data from the given region (i.e.voidEvict data from all collection regions.voidEvicts all cached query results from the default region.voidevictEntity(Class entityClass, Serializable identifier) Evicts the entity data for a particular entity "instance".voidevictEntity(String entityName, Serializable identifier) Evicts the entity data for a particular entity "instance".voidevictEntityRegion(Class entityClass) Evicts all entity data from the given region (i.e.voidevictEntityRegion(String entityName) Evicts all entity data from the given region (i.e.voidEvict data from all entity regions.voidevictQueryRegion(String regionName) Evicts all cached query results under the given name.voidEvict data from all query regions.
-
Method Details
-
containsEntity
Determine whether the cache contains data for the given entity "instance". The semantic here is whether the cache contains data visible for the current call context.- Parameters:
entityClass- The entity class.identifier- The entity identifier- Returns:
- True if the underlying cache contains corresponding data; false otherwise.
-
containsEntity
Determine whether the cache contains data for the given entity "instance". The semantic here is whether the cache contains data visible for the current call context.- Parameters:
entityName- The entity name.identifier- The entity identifier- Returns:
- True if the underlying cache contains corresponding data; false otherwise.
-
evictEntity
Evicts the entity data for a particular entity "instance".- Parameters:
entityClass- The entity class.identifier- The entity identifier
-
evictEntity
Evicts the entity data for a particular entity "instance".- Parameters:
entityName- The entity name.identifier- The entity identifier
-
evictEntityRegion
Evicts all entity data from the given region (i.e. for all entities of type).- Parameters:
entityClass- The entity class.
-
evictEntityRegion
Evicts all entity data from the given region (i.e. for all entities of type).- Parameters:
entityName- The entity name.
-
evictEntityRegions
void evictEntityRegions()Evict data from all entity regions. -
containsCollection
Determine whether the cache contains data for the given collection. The semantic here is whether the cache contains data visible for the current call context.- Parameters:
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 entity- Returns:
- True if the underlying cache contains corresponding data; false otherwise.
-
evictCollection
Evicts the cache data for the given identified collection instance.- Parameters:
role- The "collection role" (in form [owner-entity-name].[collection-property-name]).ownerIdentifier- The identifier of the owning entity
-
evictCollectionRegion
Evicts all entity data from the given region (i.e. evicts cached data for all of the specified c9ollection role).- Parameters:
role- The "collection role" (in form [owner-entity-name].[collection-property-name]).
-
evictCollectionRegions
void evictCollectionRegions()Evict data from all collection regions. -
containsQuery
Determine whether the cache contains data for the given query. The semantic here is whether the cache contains any data for the given region name since query result caches are not transactionally isolated.- Parameters:
regionName- The cache name given to the query.- Returns:
- True if the underlying cache contains corresponding data; false otherwise.
-
evictDefaultQueryRegion
void evictDefaultQueryRegion()Evicts all cached query results from the default region. -
evictQueryRegion
Evicts all cached query results under the given name.- Parameters:
regionName- The cache name associated to the queries being cached.
-
evictQueryRegions
void evictQueryRegions()Evict data from all query regions.
-