Package org.hibernate
Interface Cache
-
- All Superinterfaces:
Cache
- All Known Subinterfaces:
CacheImplementor
,CacheImplementor
public interface Cache extends 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
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description boolean
containsCollection(java.lang.String role, java.io.Serializable ownerIdentifier)
Determine whether the cache contains data for the given collection.boolean
containsEntity(java.lang.Class entityClass, java.io.Serializable identifier)
Determine whether the cache contains data for the given entity "instance".boolean
containsEntity(java.lang.String entityName, java.io.Serializable identifier)
Determine whether the cache contains data for the given entity "instance".boolean
containsQuery(java.lang.String regionName)
Determine whether the cache contains data for the given query.default void
evictAll()
default void
evictAllRegions()
Evict data from all cache regions.default void
evictCollection(java.lang.String role, java.io.Serializable ownerIdentifier)
Deprecated.UseevictCollectionData(String, Serializable)
insteadvoid
evictCollectionData()
Evict cache data for all collectionsvoid
evictCollectionData(java.lang.String role)
Evicts cached data for the given collection rolevoid
evictCollectionData(java.lang.String role, java.io.Serializable ownerIdentifier)
Evicts the cache data for the given identified collection "instance"default void
evictCollectionRegion(java.lang.String role)
Deprecated.UseevictCollectionData(String)
insteaddefault void
evictCollectionRegions()
Deprecated.UseevictCollectionData()
insteadvoid
evictDefaultQueryRegion()
Evicts all cached query results from the default region.default void
evictEntity(java.lang.Class entityClass, java.io.Serializable identifier)
Deprecated.UseevictEntityData(Class, Serializable)
insteaddefault void
evictEntity(java.lang.String entityName, java.io.Serializable identifier)
Deprecated.UseevictEntityData(String, Serializable)
insteadvoid
evictEntityData()
Evict data from all entity regions.void
evictEntityData(java.lang.Class entityClass)
Evicts all entity data from the given region (i.e.void
evictEntityData(java.lang.Class entityClass, java.io.Serializable identifier)
Evicts the entity data for a particular entity "instance".void
evictEntityData(java.lang.String entityName)
Evicts all entity data from the given region (i.e.void
evictEntityData(java.lang.String entityName, java.io.Serializable identifier)
Evicts the entity data for a particular entity "instance".default void
evictEntityRegion(java.lang.Class entityClass)
Deprecated.UseevictEntityData(Class)
insteaddefault void
evictEntityRegion(java.lang.String entityName)
Deprecated.UseevictEntityData(String)
insteaddefault void
evictEntityRegions()
Deprecated.UseevictEntityData()
insteadvoid
evictNaturalIdData()
Evict cached data for all natural-ids (for all entities)void
evictNaturalIdData(java.lang.Class entityClass)
Evict cached data for the given entity's natural-idvoid
evictNaturalIdData(java.lang.String entityName)
Evict cached data for the given entity's natural-iddefault void
evictNaturalIdRegion(java.lang.Class entityClass)
Deprecated.UseevictNaturalIdData(Class)
insteaddefault void
evictNaturalIdRegion(java.lang.String entityName)
Deprecated.UseevictNaturalIdData(String)
insteaddefault void
evictNaturalIdRegions()
Deprecated.UseevictNaturalIdData()
insteadvoid
evictQueryRegion(java.lang.String regionName)
Evicts all cached query results under the given name.void
evictQueryRegions()
Evict data from all query regions.void
evictRegion(java.lang.String regionName)
Evict all data from the named cache regionSessionFactory
getSessionFactory()
Access to the SessionFactory this Cache is bound to.
-
-
-
Method Detail
-
getSessionFactory
SessionFactory getSessionFactory()
Access to the SessionFactory this Cache is bound to.- Returns:
- The SessionFactory
-
containsEntity
boolean containsEntity(java.lang.Class entityClass, java.io.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(java.lang.String entityName, java.io.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.
-
evictEntityData
void evictEntityData(java.lang.Class entityClass, java.io.Serializable identifier)
Evicts the entity data for a particular entity "instance".- Parameters:
entityClass
- The entity class.identifier
- The entity identifier- Since:
- 5.3
-
evictEntityData
void evictEntityData(java.lang.String entityName, java.io.Serializable identifier)
Evicts the entity data for a particular entity "instance".- Parameters:
entityName
- The entity name.identifier
- The entity identifier- Since:
- 5.3
-
evictEntityData
void evictEntityData(java.lang.Class entityClass)
Evicts all entity data from the given region (i.e. for all entities of type).- Parameters:
entityClass
- The entity class.- Since:
- 5.3
-
evictEntityData
void evictEntityData(java.lang.String entityName)
Evicts all entity data from the given region (i.e. for all entities of type).- Parameters:
entityName
- The entity name.- Since:
- 5.3
-
evictEntityData
void evictEntityData()
Evict data from all entity regions.- Since:
- 5.3
-
evictNaturalIdData
void evictNaturalIdData(java.lang.Class entityClass)
Evict cached data for the given entity's natural-id- Parameters:
entityClass
- The entity class.- Since:
- 5.3
-
evictNaturalIdData
void evictNaturalIdData(java.lang.String entityName)
Evict cached data for the given entity's natural-id- Parameters:
entityName
- The entity name.- Since:
- 5.3
-
evictNaturalIdData
void evictNaturalIdData()
Evict cached data for all natural-ids (for all entities)- Since:
- 5.3
-
containsCollection
boolean containsCollection(java.lang.String role, java.io.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.
-
evictCollectionData
void evictCollectionData(java.lang.String role, java.io.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- Since:
- 5.3
-
evictCollectionData
void evictCollectionData(java.lang.String role)
Evicts cached data for the given collection role- Parameters:
role
- The "collection role" (in form [owner-entity-name].[collection-property-name]).- Since:
- 5.3
-
evictCollectionData
void evictCollectionData()
Evict cache data for all collections- Since:
- 5.3
-
containsQuery
boolean containsQuery(java.lang.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(java.lang.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.
-
evictRegion
void evictRegion(java.lang.String regionName)
Evict all data from the named cache region- Since:
- 5.3
-
evictAllRegions
default void evictAllRegions()
Evict data from all cache regions.
-
evictEntity
@Deprecated default void evictEntity(java.lang.Class entityClass, java.io.Serializable identifier)
Deprecated.UseevictEntityData(Class, Serializable)
insteadEvicts the entity data for a particular entity "instance".- Parameters:
entityClass
- The entity class.identifier
- The entity identifier
-
evictEntity
@Deprecated default void evictEntity(java.lang.String entityName, java.io.Serializable identifier)
Deprecated.UseevictEntityData(String, Serializable)
insteadEvicts the entity data for a particular entity "instance".- Parameters:
entityName
- The entity name.identifier
- The entity identifier
-
evictEntityRegion
@Deprecated default void evictEntityRegion(java.lang.Class entityClass)
Deprecated.UseevictEntityData(Class)
insteadEvicts all entity data from the given region (i.e. for all entities of type).- Parameters:
entityClass
- The entity class.
-
evictEntityRegion
@Deprecated default void evictEntityRegion(java.lang.String entityName)
Deprecated.UseevictEntityData(String)
insteadEvicts all entity data from the given region (i.e. for all entities of type).- Parameters:
entityName
- The entity name.
-
evictEntityRegions
@Deprecated default void evictEntityRegions()
Deprecated.UseevictEntityData()
insteadEvict data from all entity regions.
-
evictNaturalIdRegion
@Deprecated default void evictNaturalIdRegion(java.lang.Class entityClass)
Deprecated.UseevictNaturalIdData(Class)
insteadEvicts all naturalId data from the given region (i.e. for all entities of type).- Parameters:
entityClass
- The entity class.
-
evictNaturalIdRegion
@Deprecated default void evictNaturalIdRegion(java.lang.String entityName)
Deprecated.UseevictNaturalIdData(String)
insteadEvicts all naturalId data from the given region (i.e. for all entities of type).- Parameters:
entityName
- The entity name.
-
evictNaturalIdRegions
@Deprecated default void evictNaturalIdRegions()
Deprecated.UseevictNaturalIdData()
insteadEvict data from all naturalId regions.
-
evictCollection
@Deprecated default void evictCollection(java.lang.String role, java.io.Serializable ownerIdentifier)
Deprecated.UseevictCollectionData(String, Serializable)
insteadEvicts 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
@Deprecated default void evictCollectionRegion(java.lang.String role)
Deprecated.UseevictCollectionData(String)
insteadEvicts 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
@Deprecated default void evictCollectionRegions()
Deprecated.UseevictCollectionData()
insteadEvict data from all collection regions.
-
-