Top Description Methods
org.hibernate.cache.spi

public Interface CacheImplementor

extends Service, Cache, Serializable
Known Direct Implementers
org.hibernate.cache.internal.DisabledCaching, org.hibernate.cache.internal.EnabledCaching
Imports
java.io.Serializable, java.util.Set, org.hibernate.Cache, .HibernateException, .Internal, .Remove, org.hibernate.cache.cfg.spi.DomainDataRegionConfig, org.hibernate.cache.spi.access.CollectionDataAccess, .EntityDataAccess, .NaturalIdDataAccess, org.hibernate.engine.spi.SessionFactoryImplementor, org.hibernate.metamodel.model.domain.NavigableRole, org.hibernate.persister.entity.EntityPersister, org.hibernate.service.Service

An SPI supported by any Hibernate service that provides an implementation of the Cache API. Extends Cache with operations called internally by Hibernate.
Authors
Strong Liu, Steve Ebersole
Since
4.1

Method Summary

Modifier and TypeMethod and Description
public void
close()

Close this "cache", releasing all underlying resources.

public default void
evictQueries()

Deprecated only because it's currently never called
Clean up the default query cache
public Set<String>
getCacheRegionNames()

The unqualified name of all regions.

public @Remove CollectionDataAccess
getCollectionRegionAccess(NavigableRole collectionRole)

Find the cache data access strategy for the given collection.

public QueryResultsCache
getDefaultQueryResultsCache()

Access to the "default" region used to store query results when caching was requested but no region was explicitly named.

public @Remove EntityDataAccess
getEntityRegionAccess(NavigableRole
The NavigableRole representation of the root entity
rootEntityName
)

Find the cache data access strategy for an entity.

public @Remove NaturalIdDataAccess
getNaturalIdCacheRegionAccessStrategy(NavigableRole
The NavigableRole representation of the root entity
rootEntityName
)

Find the cache data access strategy for the given entity's natural-id cache.

public QueryResultsCache
getQueryResultsCache(String regionName)

Get query cache by region name or create a new one if none exist.

public QueryResultsCache
getQueryResultsCacheStrictly(String regionName)

Get the named QueryResultRegionAccess but not creating one if it does not already exist.

public Region
getRegion(String regionName)

Get a cache Region by name.

public RegionFactory
getRegionFactory()

The underlying RegionFactory in use.

public SessionFactoryImplementor
getSessionFactory()

Redeclares org.hibernate.Cache.getSessionFactory.

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
The SessionFactory to which this Cache belongs.
public TimestampsCache
getTimestampsCache()

Find the cache data access strategy for Hibernate's timestamps cache.

public void
prime(Set<DomainDataRegionConfig> cacheRegionConfigs)

An initialization phase allowing the caching provider to prime itself from the passed configs

Inherited from org.hibernate.Cache:
containsCollectioncontainsEntitycontainsEntitycontainsQueryevictAllevictAllRegionsevictCollectionDataevictCollectionDataevictCollectionDataevictDefaultQueryRegionevictEntityDataevictEntityDataevictEntityDataevictEntityDataevictEntityDataevictNaturalIdDataevictNaturalIdDataevictNaturalIdDataevictQueryRegionevictQueryRegionsevictRegion

Method Detail

closeback to summary
public void close()

Close this "cache", releasing all underlying resources.

evictQueriesback to summary
public default void evictQueries() throws HibernateException

Deprecated

only because it's currently never called

Clean up the default query cache

Annotations
@Deprecated
getCacheRegionNamesback to summary
public Set<String> getCacheRegionNames()

The unqualified name of all regions. Intended for use with getRegion

Since
5.3
getCollectionRegionAccessback to summary
public @Remove CollectionDataAccess getCollectionRegionAccess(NavigableRole collectionRole)

Find the cache data access strategy for the given collection. Will return null when the collection is not configured for caching.

Implementation Specification

It is only valid to call this method after prime has been performed

Annotations
@Internal
@Remove
getDefaultQueryResultsCacheback to summary
public QueryResultsCache getDefaultQueryResultsCache()

Access to the "default" region used to store query results when caching was requested but no region was explicitly named. Will return null if Hibernate is not configured for query result caching

getEntityRegionAccessback to summary
public @Remove EntityDataAccess getEntityRegionAccess(NavigableRole rootEntityName)

Find the cache data access strategy for an entity. Will return null when the entity is not configured for caching.

Implementation Specification

It is only valid to call this method after prime has been performed

Parameters
rootEntityName:NavigableRole

The NavigableRole representation of the root entity

Annotations
@Internal
@Remove
getNaturalIdCacheRegionAccessStrategyback to summary
public @Remove NaturalIdDataAccess getNaturalIdCacheRegionAccessStrategy(NavigableRole rootEntityName)

Find the cache data access strategy for the given entity's natural-id cache. Will return null when the entity does not define a natural-id, or its natural-id is not configured for caching.

Implementation Specification

It is only valid to call this method after prime has been performed

Parameters
rootEntityName:NavigableRole

The NavigableRole representation of the root entity

Annotations
@Internal
@Remove
getQueryResultsCacheback to summary
public QueryResultsCache getQueryResultsCache(String regionName)

Get query cache by region name or create a new one if none exist. If the region name is null, then default query cache region will be returned. Will return null if Hibernate is not configured for query result caching

getQueryResultsCacheStrictlyback to summary
public QueryResultsCache getQueryResultsCacheStrictly(String regionName)

Get the named QueryResultRegionAccess but not creating one if it does not already exist. This is intended for use by statistics. Will return null if Hibernate is not configured for query result caching or if no such region (yet) exists

Since
5.3
getRegionback to summary
public Region getRegion(String regionName)

Get a cache Region by name. If there is both a DomainDataRegion and a QueryResultsRegion with the specified name, then the DomainDataRegion will be returned.

API Note

It is only valid to call this method after prime has been performed

Since
5.3
getRegionFactoryback to summary
public RegionFactory getRegionFactory()

The underlying RegionFactory in use.

API Note

CacheImplementor acts partially as a wrapper for details of interacting with the configured RegionFactory. Care should be taken when accessing the RegionFactory directly.

getSessionFactoryback to summary
public SessionFactoryImplementor getSessionFactory()

Redeclares org.hibernate.Cache.getSessionFactory.

Doc from org.hibernate.Cache.getSessionFactory.

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

The SessionFactory to which this Cache belongs.

Returns:SessionFactoryImplementor

The SessionFactory

Annotations
@Override
getTimestampsCacheback to summary
public TimestampsCache getTimestampsCache()

Find the cache data access strategy for Hibernate's timestamps cache. Will return null if Hibernate is not configured for query result caching

Since
5.3
primeback to summary
public void prime(Set<DomainDataRegionConfig> cacheRegionConfigs)

An initialization phase allowing the caching provider to prime itself from the passed configs

Since
5.3