Top Description Methods
org.hibernate

public Interface Cache

Known Direct Implementers
org.hibernate.impl.SessionFactoryImpl.CacheImpl
Imports
java.io.Serializable

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

Author
Steve Ebersole

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

True if the underlying cache contains corresponding data; false otherwise.
containsCollection
(String
The name of the collection role (in form [owner-entity-name].[collection-property-name]) whose regions should be evicted.
role
,
Serializable
The identifier of the owning entity
ownerIdentifier
)

Determine whether the cache contains data for the given collection.

public boolean

Returns:

True if the underlying cache contains corresponding data; false otherwise.
containsEntity
(Class<T>
The entity class.
entityClass
,
Serializable
The entity identifier
identifier
)

Determine whether the cache contains data for the given entity "instance".

public boolean

Returns:

True if the underlying cache contains corresponding data; false otherwise.
containsEntity
(String
The entity name.
entityName
,
Serializable
The entity identifier
identifier
)

Determine whether the cache contains data for the given entity "instance".

public boolean

Returns:

True if the underlying cache contains corresponding data; false otherwise.
containsQuery
(String
The cache name given to the query.
regionName
)

Determine whether the cache contains data for the given query.

public void
evictCollection(String
The "collection role" (in form [owner-entity-name].[collection-property-name]).
role
,
Serializable
The identifier of the owning entity
ownerIdentifier
)

Evicts the cache data for the given identified collection instance.

public void
evictCollectionRegion(String
The "collection role" (in form [owner-entity-name].[collection-property-name]).
role
)

Evicts all entity data from the given region (i.e. evicts cached data for all of the specified c9ollection role).

public void
evictCollectionRegions()

Evict data from all collection regions.

public void
evictDefaultQueryRegion()

Evicts all cached query results from the default region.

public void
evictEntity(Class<T>
The entity class.
entityClass
,
Serializable
The entity identifier
identifier
)

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

public void
evictEntity(String
The entity name.
entityName
,
Serializable
The entity identifier
identifier
)

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

public void
evictEntityRegion(Class<T>
The entity class.
entityClass
)

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

public void
evictEntityRegion(String
The entity name.
entityName
)

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

public void
evictEntityRegions()

Evict data from all entity regions.

public void
evictQueryRegion(String
The cache name associated to the queries being cached.
regionName
)

Evicts all cached query results under the given name.

public void
evictQueryRegions()

Evict data from all query regions.

Method Detail

containsCollectionback to summary
public 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:String

The name of the collection role (in form [owner-entity-name].[collection-property-name]) whose regions should be evicted.

ownerIdentifier:Serializable

The identifier of the owning entity

Returns:boolean

True if the underlying cache contains corresponding data; false otherwise.

containsEntityback to summary
public boolean containsEntity(Class<T> 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:Class<T>

The entity class.

identifier:Serializable

The entity identifier

Returns:boolean

True if the underlying cache contains corresponding data; false otherwise.

containsEntityback to summary
public 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:String

The entity name.

identifier:Serializable

The entity identifier

Returns:boolean

True if the underlying cache contains corresponding data; false otherwise.

containsQueryback to summary
public 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:String

The cache name given to the query.

Returns:boolean

True if the underlying cache contains corresponding data; false otherwise.

evictCollectionback to summary
public void evictCollection(String role, Serializable ownerIdentifier)

Evicts the cache data for the given identified collection instance.

Parameters
role:String

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

ownerIdentifier:Serializable

The identifier of the owning entity

evictCollectionRegionback to summary
public 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:String

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

evictCollectionRegionsback to summary
public void evictCollectionRegions()

Evict data from all collection regions.

evictDefaultQueryRegionback to summary
public void evictDefaultQueryRegion()

Evicts all cached query results from the default region.

evictEntityback to summary
public void evictEntity(Class<T> entityClass, Serializable identifier)

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

Parameters
entityClass:Class<T>

The entity class.

identifier:Serializable

The entity identifier

evictEntityback to summary
public void evictEntity(String entityName, Serializable identifier)

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

Parameters
entityName:String

The entity name.

identifier:Serializable

The entity identifier

evictEntityRegionback to summary
public void evictEntityRegion(Class<T> entityClass)

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

Parameters
entityClass:Class<T>

The entity class.

evictEntityRegionback to summary
public void evictEntityRegion(String entityName)

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

Parameters
entityName:String

The entity name.

evictEntityRegionsback to summary
public void evictEntityRegions()

Evict data from all entity regions.

evictQueryRegionback to summary
public void evictQueryRegion(String regionName)

Evicts all cached query results under the given name.

Parameters
regionName:String

The cache name associated to the queries being cached.

evictQueryRegionsback to summary
public void evictQueryRegions()

Evict data from all query regions.