程序包 org.hibernate

接口 Cache

  • 所有超级接口:
    javax.persistence.Cache
    所有已知子接口:
    CacheImplementor, CacheImplementor
    所有已知实现类:
    DisabledCaching, EnabledCaching

    public interface Cache
    extends javax.persistence.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).

    作者:
    Steve Ebersole
    • 方法详细资料

      • getSessionFactory

        SessionFactory getSessionFactory()
        Access to the SessionFactory this Cache is bound to.
        返回:
        The SessionFactory
      • containsEntity

        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.

        参数:
        entityClass - The entity class.
        identifier - The entity identifier
        返回:
        True if the underlying cache contains corresponding data; false otherwise.
      • containsEntity

        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.

        参数:
        entityName - The entity name.
        identifier - The entity identifier
        返回:
        True if the underlying cache contains corresponding data; false otherwise.
      • evictEntityData

        void evictEntityData​(Class entityClass,
                             Serializable identifier)
        Evicts the entity data for a particular entity "instance".
        参数:
        entityClass - The entity class.
        identifier - The entity identifier
        从以下版本开始:
        5.3
      • evictEntityData

        void evictEntityData​(String entityName,
                             Serializable identifier)
        Evicts the entity data for a particular entity "instance".
        参数:
        entityName - The entity name.
        identifier - The entity identifier
        从以下版本开始:
        5.3
      • evictEntityData

        void evictEntityData​(Class entityClass)
        Evicts all entity data from the given region (i.e. for all entities of type).
        参数:
        entityClass - The entity class.
        从以下版本开始:
        5.3
      • evictEntityData

        void evictEntityData​(String entityName)
        Evicts all entity data from the given region (i.e. for all entities of type).
        参数:
        entityName - The entity name.
        从以下版本开始:
        5.3
      • evictEntityData

        void evictEntityData()
        Evict data from all entity regions.
        从以下版本开始:
        5.3
      • evictNaturalIdData

        void evictNaturalIdData​(Class entityClass)
        Evict cached data for the given entity's natural-id
        参数:
        entityClass - The entity class.
        从以下版本开始:
        5.3
      • evictNaturalIdData

        void evictNaturalIdData​(String entityName)
        Evict cached data for the given entity's natural-id
        参数:
        entityName - The entity name.
        从以下版本开始:
        5.3
      • evictNaturalIdData

        void evictNaturalIdData()
        Evict cached data for all natural-ids (for all entities)
        从以下版本开始:
        5.3
      • containsCollection

        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.

        参数:
        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
        返回:
        True if the underlying cache contains corresponding data; false otherwise.
      • evictCollectionData

        void 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 entity
        从以下版本开始:
        5.3
      • evictCollectionData

        void evictCollectionData​(String role)
        Evicts cached data for the given collection role
        参数:
        role - The "collection role" (in form [owner-entity-name].[collection-property-name]).
        从以下版本开始:
        5.3
      • evictCollectionData

        void evictCollectionData()
        Evict cache data for all collections
        从以下版本开始:
        5.3
      • containsQuery

        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.

        参数:
        regionName - The cache name given to the query.
        返回:
        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​(String regionName)
        Evicts all cached query results under the given name.
        参数:
        regionName - The cache name associated to the queries being cached.
      • evictQueryRegions

        void evictQueryRegions()
        Evict data from all query regions.
      • evictRegion

        void evictRegion​(String regionName)
        Evict all data from the named cache region
        从以下版本开始:
        5.3
      • evictAll

        default void evictAll()
        指定者:
        evictAll 在接口中 javax.persistence.Cache
      • evictAllRegions

        default void evictAllRegions()
        Evict data from all cache regions.
      • evictEntityRegion

        @Deprecated
        default void evictEntityRegion​(Class entityClass)
        已过时。
        Evicts all entity data from the given region (i.e. for all entities of type).
        参数:
        entityClass - The entity class.
      • evictEntityRegion

        @Deprecated
        default void evictEntityRegion​(String entityName)
        已过时。
        Evicts all entity data from the given region (i.e. for all entities of type).
        参数:
        entityName - The entity name.
      • evictEntityRegions

        @Deprecated
        default void evictEntityRegions()
        已过时。
        Use evictEntityData() instead
        Evict data from all entity regions.
      • evictNaturalIdRegion

        @Deprecated
        default void evictNaturalIdRegion​(Class entityClass)
        已过时。
        Evicts all naturalId data from the given region (i.e. for all entities of type).
        参数:
        entityClass - The entity class.
      • evictNaturalIdRegion

        @Deprecated
        default void evictNaturalIdRegion​(String entityName)
        已过时。
        Evicts all naturalId data from the given region (i.e. for all entities of type).
        参数:
        entityName - The entity name.
      • evictNaturalIdRegions

        @Deprecated
        default void evictNaturalIdRegions()
        已过时。
        Evict data from all naturalId regions.
      • evictCollection

        @Deprecated
        default void evictCollection​(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 entity
      • evictCollectionRegion

        @Deprecated
        default void evictCollectionRegion​(String role)
        已过时。
        Evicts 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]).
      • evictCollectionRegions

        @Deprecated
        default void evictCollectionRegions()
        已过时。
        Evict data from all collection regions.