org.hibernate
Interface Cache

All Known Subinterfaces:
CacheImplementor
All Known Implementing Classes:
CacheImpl

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
 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 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.
 

Method Detail

containsEntity

boolean containsEntity(Class entityClass,
                       Serializable identifier)
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

boolean containsEntity(String entityName,
                       Serializable identifier)
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

void evictEntity(Class entityClass,
                 Serializable identifier)
Evicts the entity data for a particular entity "instance".

Parameters:
entityClass - The entity class.
identifier - The entity identifier

evictEntity

void evictEntity(String entityName,
                 Serializable identifier)
Evicts the entity data for a particular entity "instance".

Parameters:
entityName - The entity name.
identifier - The entity identifier

evictEntityRegion

void evictEntityRegion(Class entityClass)
Evicts all entity data from the given region (i.e. for all entities of type).

Parameters:
entityClass - The entity class.

evictEntityRegion

void evictEntityRegion(String entityName)
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.


evictNaturalIdRegion

void evictNaturalIdRegion(Class naturalIdClass)
Evicts all naturalId data from the given region (i.e. for all entities of type).

Parameters:
naturalIdClass - The naturalId class.

evictNaturalIdRegion

void evictNaturalIdRegion(String naturalIdName)
Evicts all naturalId data from the given region (i.e. for all entities of type).

Parameters:
naturalIdName - The naturalId name.

evictNaturalIdRegions

void evictNaturalIdRegions()
Evict data from all naturalId regions.


containsCollection

boolean containsCollection(String role,
                           Serializable ownerIdentifier)
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

void evictCollection(String role,
                     Serializable ownerIdentifier)
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

void evictCollectionRegion(String role)
Evicts all entity data from the given region (i.e. evicts cached data for all of the specified collection role).

Parameters:
role - The "collection role" (in form [owner-entity-name].[collection-property-name]).

evictCollectionRegions

void evictCollectionRegions()
Evict data from all collection regions.


containsQuery

boolean containsQuery(String regionName)
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

void evictQueryRegion(String regionName)
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.



Copyright © 2001-2013 Red Hat, Inc. All Rights Reserved.