public interface Cache extends Cache
Provides an API for querying/managing the second level cache regions. <p/> 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).
Modifier and Type | Method and Description |
---|---|
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.
|
default void |
evictAll() |
default void |
evictAllRegions()
Evict data from all cache regions.
|
default void |
evictCollection(String role,
Serializable ownerIdentifier)
Deprecated.
Use
evictCollectionData(String, Serializable) instead |
void |
evictCollectionData()
Evict cache data for all collections
|
void |
evictCollectionData(String role)
Evicts cached data for the given collection role
|
void |
evictCollectionData(String role,
Serializable ownerIdentifier)
Evicts the cache data for the given identified collection "instance"
|
default void |
evictCollectionRegion(String role)
Deprecated.
Use
evictCollectionData(String) instead |
default void |
evictCollectionRegions()
Deprecated.
Use
evictCollectionData() instead |
void |
evictDefaultQueryRegion()
Evicts all cached query results from the default region.
|
default void |
evictEntity(Class entityClass,
Serializable identifier)
Deprecated.
Use
evictEntityData(Class, Serializable) instead |
default void |
evictEntity(String entityName,
Serializable identifier)
Deprecated.
Use
evictEntityData(String, Serializable) instead |
void |
evictEntityData()
Evict data from all entity regions.
|
void |
evictEntityData(Class entityClass)
Evicts all entity data from the given region (i.e.
|
void |
evictEntityData(Class entityClass,
Serializable identifier)
Evicts the entity data for a particular entity "instance".
|
void |
evictEntityData(String entityName)
Evicts all entity data from the given region (i.e.
|
void |
evictEntityData(String entityName,
Serializable identifier)
Evicts the entity data for a particular entity "instance".
|
default void |
evictEntityRegion(Class entityClass)
Deprecated.
Use
evictEntityData(Class) instead |
default void |
evictEntityRegion(String entityName)
Deprecated.
Use
evictEntityData(String) instead |
default void |
evictEntityRegions()
Deprecated.
Use
evictEntityData() instead |
void |
evictNaturalIdData()
Evict cached data for all natural-ids (for all entities)
|
void |
evictNaturalIdData(Class entityClass)
Evict cached data for the given entity’s natural-id
|
void |
evictNaturalIdData(String entityName)
Evict cached data for the given entity’s natural-id
|
default void |
evictNaturalIdRegion(Class entityClass)
Deprecated.
Use
evictNaturalIdData(Class) instead |
default void |
evictNaturalIdRegion(String entityName)
Deprecated.
Use
evictNaturalIdData(String) instead |
default void |
evictNaturalIdRegions()
Deprecated.
Use
evictNaturalIdData() instead |
void |
evictQueryRegion(String regionName)
Evicts all cached query results under the given name.
|
void |
evictQueryRegions()
Evict data from all query regions.
|
void |
evictRegion(String regionName)
Evict all data from the named cache region
|
SessionFactory |
getSessionFactory()
Access to the SessionFactory this Cache is bound to.
|
SessionFactory getSessionFactory()
Access to the SessionFactory this Cache is bound to.
boolean containsEntity(Class entityClass, Serializable identifier)
Determine whether the cache contains data for the given entity "instance". <p/> The semantic here is whether the cache contains data visible for the current call context.
entityClass
- The entity class.identifier
- The entity identifierboolean containsEntity(String entityName, Serializable identifier)
Determine whether the cache contains data for the given entity "instance". <p/> The semantic here is whether the cache contains data visible for the current call context.
entityName
- The entity name.identifier
- The entity identifiervoid evictEntityData(Class entityClass, Serializable identifier)
Evicts the entity data for a particular entity "instance".
entityClass
- The entity class.identifier
- The entity identifiervoid evictEntityData(String entityName, Serializable identifier)
Evicts the entity data for a particular entity "instance".
entityName
- The entity name.identifier
- The entity identifiervoid evictEntityData(Class entityClass)
Evicts all entity data from the given region (i.e. for all entities of type).
entityClass
- The entity class.void evictEntityData(String entityName)
Evicts all entity data from the given region (i.e. for all entities of type).
entityName
- The entity name.void evictEntityData()
Evict data from all entity regions.
void evictNaturalIdData(Class entityClass)
Evict cached data for the given entity’s natural-id
entityClass
- The entity class.void evictNaturalIdData(String entityName)
Evict cached data for the given entity’s natural-id
entityName
- The entity name.void evictNaturalIdData()
Evict cached data for all natural-ids (for all entities)
boolean containsCollection(String role, Serializable ownerIdentifier)
Determine whether the cache contains data for the given collection. <p/> The semantic here is whether the cache contains data visible for the current call context.
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 entityvoid evictCollectionData(String role, Serializable ownerIdentifier)
Evicts the cache data for the given identified collection "instance"
role
- The "collection role" (in form [owner-entity-name].[collection-property-name]).ownerIdentifier
- The identifier of the owning entityvoid evictCollectionData(String role)
Evicts cached data for the given collection role
role
- The "collection role" (in form [owner-entity-name].[collection-property-name]).void evictCollectionData()
Evict cache data for all collections
boolean containsQuery(String regionName)
Determine whether the cache contains data for the given query. <p/> The semantic here is whether the cache contains any data for the given region name since query result caches are not transactionally isolated.
regionName
- The cache name given to the query.void evictDefaultQueryRegion()
Evicts all cached query results from the default region.
void evictQueryRegion(String regionName)
Evicts all cached query results under the given name.
regionName
- The cache name associated to the queries being cached.void evictQueryRegions()
Evict data from all query regions.
void evictRegion(String regionName)
Evict all data from the named cache region
default void evictAllRegions()
Evict data from all cache regions.
@Deprecated default void evictEntity(Class entityClass, Serializable identifier)
evictEntityData(Class, Serializable)
insteadEvicts the entity data for a particular entity "instance".
entityClass
- The entity class.identifier
- The entity identifier@Deprecated default void evictEntity(String entityName, Serializable identifier)
evictEntityData(String, Serializable)
insteadEvicts the entity data for a particular entity "instance".
entityName
- The entity name.identifier
- The entity identifier@Deprecated default void evictEntityRegion(Class entityClass)
evictEntityData(Class)
insteadEvicts all entity data from the given region (i.e. for all entities of type).
entityClass
- The entity class.@Deprecated default void evictEntityRegion(String entityName)
evictEntityData(String)
insteadEvicts all entity data from the given region (i.e. for all entities of type).
entityName
- The entity name.@Deprecated default void evictEntityRegions()
evictEntityData()
insteadEvict data from all entity regions.
@Deprecated default void evictNaturalIdRegion(Class entityClass)
evictNaturalIdData(Class)
insteadEvicts all naturalId data from the given region (i.e. for all entities of type).
entityClass
- The entity class.@Deprecated default void evictNaturalIdRegion(String entityName)
evictNaturalIdData(String)
insteadEvicts all naturalId data from the given region (i.e. for all entities of type).
entityName
- The entity name.@Deprecated default void evictNaturalIdRegions()
evictNaturalIdData()
insteadEvict data from all naturalId regions.
@Deprecated default void evictCollection(String role, Serializable ownerIdentifier)
evictCollectionData(String, Serializable)
insteadEvicts the cache data for the given identified collection instance.
role
- The "collection role" (in form [owner-entity-name].[collection-property-name]).ownerIdentifier
- The identifier of the owning entity@Deprecated default void evictCollectionRegion(String role)
evictCollectionData(String)
insteadEvicts all entity data from the given region (i.e. evicts cached data for all of the specified collection role).
role
- The "collection role" (in form [owner-entity-name].[collection-property-name]).@Deprecated default void evictCollectionRegions()
evictCollectionData()
insteadEvict data from all collection regions.
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.