Class AbstractQueryCompilationCache
java.lang.Object
org.datanucleus.store.query.cache.AbstractQueryCompilationCache
- All Implemented Interfaces:
QueryCompilationCache
- Direct Known Subclasses:
SoftQueryCompilationCache, StrongQueryCompilationCache, WeakQueryCompilationCache
Abstract representation of a cache of generic query compilations.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Method to clear the cache.voidclose()Method to close the cache when no longer needed.booleanAccessor for whether the specified query is in the cachevoidEvict the query from the compilation cache.Accessor for a (generic) compilation from the cache.booleanisEmpty()Accessor for whether the cache is empty.put(String queryKey, QueryCompilation compilation) Method to put an object in the cache.intsize()Accessor for the total number of compilations in the query cache.
-
Field Details
-
cache
Map<String, QueryCompilation> cache
-
-
Constructor Details
-
AbstractQueryCompilationCache
public AbstractQueryCompilationCache()
-
-
Method Details
-
clear
public void clear()Description copied from interface:QueryCompilationCacheMethod to clear the cache.- Specified by:
clearin interfaceQueryCompilationCache
-
close
public void close()Description copied from interface:QueryCompilationCacheMethod to close the cache when no longer needed. Provides a hook to release resources etc.- Specified by:
closein interfaceQueryCompilationCache
-
contains
Description copied from interface:QueryCompilationCacheAccessor for whether the specified query is in the cache- Specified by:
containsin interfaceQueryCompilationCache- Parameters:
queryKey- The query key- Returns:
- Whether it is in the cache
-
evict
Description copied from interface:QueryCompilationCacheEvict the query from the compilation cache.- Specified by:
evictin interfaceQueryCompilationCache- Parameters:
queryKey- Key for the query to evict.
-
get
Description copied from interface:QueryCompilationCacheAccessor for a (generic) compilation from the cache.- Specified by:
getin interfaceQueryCompilationCache- Parameters:
queryKey- The query key- Returns:
- The cached query compilation
-
isEmpty
public boolean isEmpty()Description copied from interface:QueryCompilationCacheAccessor for whether the cache is empty.- Specified by:
isEmptyin interfaceQueryCompilationCache- Returns:
- Whether it is empty.
-
put
Description copied from interface:QueryCompilationCacheMethod to put an object in the cache.- Specified by:
putin interfaceQueryCompilationCache- Parameters:
queryKey- The query keycompilation- The compilation to cache- Returns:
- The cached query previously associated with this query
-
size
public int size()Description copied from interface:QueryCompilationCacheAccessor for the total number of compilations in the query cache.- Specified by:
sizein interfaceQueryCompilationCache- Returns:
- Number of queries
-