Class AbstractQueryDatastoreCompilationCache
- java.lang.Object
-
- org.datanucleus.store.query.cache.AbstractQueryDatastoreCompilationCache
-
- All Implemented Interfaces:
QueryDatastoreCompilationCache
- Direct Known Subclasses:
SoftQueryDatastoreCompilationCache,StrongQueryDatastoreCompilationCache,WeakQueryDatastoreCompilationCache
public abstract class AbstractQueryDatastoreCompilationCache extends Object implements QueryDatastoreCompilationCache
Abstract representation of a query compilation cache for the query specific to the datastore.
-
-
Constructor Summary
Constructors Constructor Description AbstractQueryDatastoreCompilationCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Method to clear the cache.voidclose()Method to close the cache when no longer needed.booleancontains(String queryKey)Accessor for whether the specified query is in the cachevoidevict(String queryKey)Evict the query from the compilation cache.Objectget(String queryKey)Accessor for a (generic) compilation from the cache.booleanisEmpty()Accessor for whether the cache is empty.Objectput(String queryKey, Object compilation)Method to put an object in the cache.intsize()Accessor for the total number of compilations in the query cache.
-
-
-
Method Detail
-
clear
public void clear()
Description copied from interface:QueryDatastoreCompilationCacheMethod to clear the cache.- Specified by:
clearin interfaceQueryDatastoreCompilationCache
-
close
public void close()
Description copied from interface:QueryDatastoreCompilationCacheMethod to close the cache when no longer needed. Provides a hook to release resources etc.- Specified by:
closein interfaceQueryDatastoreCompilationCache
-
contains
public boolean contains(String queryKey)
Description copied from interface:QueryDatastoreCompilationCacheAccessor for whether the specified query is in the cache- Specified by:
containsin interfaceQueryDatastoreCompilationCache- Parameters:
queryKey- The query key- Returns:
- Whether it is in the cache
-
evict
public void evict(String queryKey)
Description copied from interface:QueryDatastoreCompilationCacheEvict the query from the compilation cache.- Specified by:
evictin interfaceQueryDatastoreCompilationCache- Parameters:
queryKey- Key for the query to evict.
-
get
public Object get(String queryKey)
Description copied from interface:QueryDatastoreCompilationCacheAccessor for a (generic) compilation from the cache.- Specified by:
getin interfaceQueryDatastoreCompilationCache- Parameters:
queryKey- The query key- Returns:
- The cached query compilation
-
isEmpty
public boolean isEmpty()
Description copied from interface:QueryDatastoreCompilationCacheAccessor for whether the cache is empty.- Specified by:
isEmptyin interfaceQueryDatastoreCompilationCache- Returns:
- Whether it is empty.
-
put
public Object put(String queryKey, Object compilation)
Description copied from interface:QueryDatastoreCompilationCacheMethod to put an object in the cache.- Specified by:
putin interfaceQueryDatastoreCompilationCache- Parameters:
queryKey- The query keycompilation- The compilation for this datastore- Returns:
- The cached compilation previously associated with this query (if any)
-
size
public int size()
Description copied from interface:QueryDatastoreCompilationCacheAccessor for the total number of compilations in the query cache.- Specified by:
sizein interfaceQueryDatastoreCompilationCache- Returns:
- Number of queries
-
-