public interface

Cache

org.hibernate.Cache

Class Overview

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

Summary

Public Methods
abstract boolean containsCollection(String role, Serializable ownerIdentifier)
Determine whether the cache contains data for the given collection.
abstract boolean containsEntity(String entityName, Serializable identifier)
Determine whether the cache contains data for the given entity "instance".
abstract boolean containsEntity(Class entityClass, Serializable identifier)
Determine whether the cache contains data for the given entity "instance".
abstract boolean containsQuery(String regionName)
Determine whether the cache contains data for the given query.
abstract void evictCollection(String role, Serializable ownerIdentifier)
Evicts the cache data for the given identified collection instance.
abstract void evictCollectionRegion(String role)
Evicts all entity data from the given region (i.e.
abstract void evictCollectionRegions()
Evict data from all collection regions.
abstract void evictDefaultQueryRegion()
Evicts all cached query results from the default region.
abstract void evictEntity(Class entityClass, Serializable identifier)
Evicts the entity data for a particular entity "instance".
abstract void evictEntity(String entityName, Serializable identifier)
Evicts the entity data for a particular entity "instance".
abstract void evictEntityRegion(String entityName)
Evicts all entity data from the given region (i.e.
abstract void evictEntityRegion(Class entityClass)
Evicts all entity data from the given region (i.e.
abstract void evictEntityRegions()
Evict data from all entity regions.
abstract void evictQueryRegion(String regionName)
Evicts all cached query results under the given name.
abstract void evictQueryRegions()
Evict data from all query regions.

Public Methods

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

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

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

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

public abstract 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

public abstract void evictCollectionRegion (String role)

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

public abstract void evictCollectionRegions ()

Evict data from all collection regions.

public abstract void evictDefaultQueryRegion ()

Evicts all cached query results from the default region.

public abstract void evictEntity (Class entityClass, Serializable identifier)

Evicts the entity data for a particular entity "instance".

Parameters
entityClass The entity class.
identifier The entity identifier

public abstract void evictEntity (String entityName, Serializable identifier)

Evicts the entity data for a particular entity "instance".

Parameters
entityName The entity name.
identifier The entity identifier

public abstract void evictEntityRegion (String entityName)

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

Parameters
entityName The entity name.

public abstract void evictEntityRegion (Class entityClass)

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

Parameters
entityClass The entity class.

public abstract void evictEntityRegions ()

Evict data from all entity regions.

public abstract void evictQueryRegion (String regionName)

Evicts all cached query results under the given name.

Parameters
regionName The cache name associated to the queries being cached.

public abstract void evictQueryRegions ()

Evict data from all query regions.