Package org.hibernate.query.internal
Class QueryInterpretationCacheStandardImpl
- java.lang.Object
-
- org.hibernate.query.internal.QueryInterpretationCacheStandardImpl
-
- All Implemented Interfaces:
QueryInterpretationCache
public class QueryInterpretationCacheStandardImpl extends Object implements QueryInterpretationCache
Standard QueryInterpretationCache implementation
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.hibernate.query.spi.QueryInterpretationCache
QueryInterpretationCache.Key
-
-
Constructor Summary
Constructors Constructor Description QueryInterpretationCacheStandardImpl(int maxQueryPlanCount, Supplier<StatisticsImplementor> statisticsSupplier)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcacheNonSelectQueryPlan(QueryInterpretationCache.Key key, NonSelectQueryPlan plan)voidclose()Close the cache when the SessionFactory is closed.protected static <R> HqlInterpretation<R>createHqlInterpretation(String queryString, Class<R> expectedResultType, HqlTranslator translator, StatisticsImplementor statistics)NonSelectQueryPlangetNonSelectQueryPlan(QueryInterpretationCache.Key key)intgetNumberOfCachedHqlInterpretations()intgetNumberOfCachedQueryPlans()booleanisEnabled()<R> HqlInterpretation<R>resolveHqlInterpretation(String queryString, Class<R> expectedResultType, HqlTranslator translator)ParameterInterpretationresolveNativeQueryParameters(String queryString, Function<String,ParameterInterpretation> creator)<R> SelectQueryPlan<R>resolveSelectQueryPlan(QueryInterpretationCache.Key key, Supplier<SelectQueryPlan<R>> creator)
-
-
-
Constructor Detail
-
QueryInterpretationCacheStandardImpl
public QueryInterpretationCacheStandardImpl(int maxQueryPlanCount, Supplier<StatisticsImplementor> statisticsSupplier)
-
-
Method Detail
-
getNumberOfCachedHqlInterpretations
public int getNumberOfCachedHqlInterpretations()
- Specified by:
getNumberOfCachedHqlInterpretationsin interfaceQueryInterpretationCache
-
getNumberOfCachedQueryPlans
public int getNumberOfCachedQueryPlans()
- Specified by:
getNumberOfCachedQueryPlansin interfaceQueryInterpretationCache
-
resolveSelectQueryPlan
public <R> SelectQueryPlan<R> resolveSelectQueryPlan(QueryInterpretationCache.Key key, Supplier<SelectQueryPlan<R>> creator)
- Specified by:
resolveSelectQueryPlanin interfaceQueryInterpretationCache
-
getNonSelectQueryPlan
public NonSelectQueryPlan getNonSelectQueryPlan(QueryInterpretationCache.Key key)
- Specified by:
getNonSelectQueryPlanin interfaceQueryInterpretationCache
-
cacheNonSelectQueryPlan
public void cacheNonSelectQueryPlan(QueryInterpretationCache.Key key, NonSelectQueryPlan plan)
- Specified by:
cacheNonSelectQueryPlanin interfaceQueryInterpretationCache
-
resolveHqlInterpretation
public <R> HqlInterpretation<R> resolveHqlInterpretation(String queryString, Class<R> expectedResultType, HqlTranslator translator)
- Specified by:
resolveHqlInterpretationin interfaceQueryInterpretationCache
-
createHqlInterpretation
protected static <R> HqlInterpretation<R> createHqlInterpretation(String queryString, Class<R> expectedResultType, HqlTranslator translator, StatisticsImplementor statistics)
-
resolveNativeQueryParameters
public ParameterInterpretation resolveNativeQueryParameters(String queryString, Function<String,ParameterInterpretation> creator)
- Specified by:
resolveNativeQueryParametersin interfaceQueryInterpretationCache
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabledin interfaceQueryInterpretationCache
-
close
public void close()
Description copied from interface:QueryInterpretationCacheClose the cache when the SessionFactory is closed.Note that depending on the cache strategy implementation chosen, clearing the cache might not reclaim all the memory.
Typically, when using LIRS, clearing the cache only invalidates the entries but the outdated entries are kept in memory until they are replaced by others. It is not considered a memory leak as the cache is bounded.
- Specified by:
closein interfaceQueryInterpretationCache
-
-