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 booleancontainsCollection(java.lang.String role, java.io.Serializable ownerIdentifier)Determine whether the cache contains data for the given collection.booleancontainsEntity(java.lang.Class entityClass, java.io.Serializable identifier)Determine whether the cache contains data for the given entity "instance".booleancontainsEntity(java.lang.String entityName, java.io.Serializable identifier)Determine whether the cache contains data for the given entity "instance".booleancontainsQuery(java.lang.String regionName)Determine whether the cache contains data for the given query.default voidevictAll()default voidevictAllRegions()Evict data from all cache regions.default voidevictCollection(java.lang.String role, java.io.Serializable ownerIdentifier)Deprecated.UseevictCollectionData(String, Serializable)insteadvoidevictCollectionData()Evict cache data for all collectionsvoidevictCollectionData(java.lang.String role)Evicts cached data for the given collection rolevoidevictCollectionData(java.lang.String role, java.io.Serializable ownerIdentifier)Evicts the cache data for the given identified collection "instance"default voidevictCollectionRegion(java.lang.String role)Deprecated.UseevictCollectionData(String)insteaddefault voidevictCollectionRegions()Deprecated.UseevictCollectionData()insteadvoidevictDefaultQueryRegion()Evicts all cached query results from the default region.default voidevictEntity(java.lang.Class entityClass, java.io.Serializable identifier)Deprecated.UseevictEntityData(Class, Serializable)insteaddefault voidevictEntity(java.lang.String entityName, java.io.Serializable identifier)Deprecated.UseevictEntityData(String, Serializable)insteadvoidevictEntityData()Evict data from all entity regions.voidevictEntityData(java.lang.Class entityClass)Evicts all entity data from the given region (i.e.voidevictEntityData(java.lang.Class entityClass, java.io.Serializable identifier)Evicts the entity data for a particular entity "instance".voidevictEntityData(java.lang.String entityName)Evicts all entity data from the given region (i.e.voidevictEntityData(java.lang.String entityName, java.io.Serializable identifier)Evicts the entity data for a particular entity "instance".default voidevictEntityRegion(java.lang.Class entityClass)Deprecated.UseevictEntityData(Class)insteaddefault voidevictEntityRegion(java.lang.String entityName)Deprecated.UseevictEntityData(String)insteaddefault voidevictEntityRegions()Deprecated.UseevictEntityData()insteadvoidevictNaturalIdData()Evict cached data for all natural-ids (for all entities)voidevictNaturalIdData(java.lang.Class entityClass)Evict cached data for the given entity's natural-idvoidevictNaturalIdData(java.lang.String entityName)Evict cached data for the given entity's natural-iddefault voidevictNaturalIdRegion(java.lang.Class entityClass)Deprecated.UseevictNaturalIdData(Class)insteaddefault voidevictNaturalIdRegion(java.lang.String entityName)Deprecated.UseevictNaturalIdData(String)insteaddefault voidevictNaturalIdRegions()Deprecated.UseevictNaturalIdData()insteadvoidevictQueryRegion(java.lang.String regionName)Evicts all cached query results under the given name.voidevictQueryRegions()Evict data from all query regions.voidevictRegion(java.lang.String regionName)Evict all data from the named cache regionSessionFactorygetSessionFactory()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.
-
-