Class JavaxCacheQueryDatastoreCompilationCache
- java.lang.Object
-
- org.datanucleus.store.query.cache.JavaxCacheQueryDatastoreCompilationCache
-
- All Implemented Interfaces:
java.io.Serializable
,QueryDatastoreCompilationCache
public class JavaxCacheQueryDatastoreCompilationCache extends java.lang.Object implements QueryDatastoreCompilationCache, java.io.Serializable
Query compilation (datastore) cache using javax.cache for implementation.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private javax.cache.Cache<java.lang.String,java.lang.Object>
cache
The cache to use.private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description JavaxCacheQueryDatastoreCompilationCache(NucleusContext nucleusCtx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Method to clear the cache.void
close()
Method to close the cache when no longer needed.boolean
contains(java.lang.String queryKey)
Accessor for whether the specified query is in the cachevoid
evict(java.lang.String queryKey)
Evict the query from the compilation cache.java.lang.Object
get(java.lang.String queryKey)
Accessor for a (generic) compilation from the cache.boolean
isEmpty()
Accessor for whether the cache is empty.java.lang.Object
put(java.lang.String queryKey, java.lang.Object compilation)
Method to put an object in the cache.int
size()
Accessor for the total number of compilations in the query cache.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
cache
private javax.cache.Cache<java.lang.String,java.lang.Object> cache
The cache to use.
-
-
Constructor Detail
-
JavaxCacheQueryDatastoreCompilationCache
public JavaxCacheQueryDatastoreCompilationCache(NucleusContext nucleusCtx)
-
-
Method Detail
-
close
public void close()
Description copied from interface:QueryDatastoreCompilationCache
Method to close the cache when no longer needed. Provides a hook to release resources etc.- Specified by:
close
in interfaceQueryDatastoreCompilationCache
-
evict
public void evict(java.lang.String queryKey)
Description copied from interface:QueryDatastoreCompilationCache
Evict the query from the compilation cache.- Specified by:
evict
in interfaceQueryDatastoreCompilationCache
- Parameters:
queryKey
- Key for the query to evict.
-
clear
public void clear()
Description copied from interface:QueryDatastoreCompilationCache
Method to clear the cache.- Specified by:
clear
in interfaceQueryDatastoreCompilationCache
-
isEmpty
public boolean isEmpty()
Description copied from interface:QueryDatastoreCompilationCache
Accessor for whether the cache is empty.- Specified by:
isEmpty
in interfaceQueryDatastoreCompilationCache
- Returns:
- Whether it is empty.
-
size
public int size()
Description copied from interface:QueryDatastoreCompilationCache
Accessor for the total number of compilations in the query cache.- Specified by:
size
in interfaceQueryDatastoreCompilationCache
- Returns:
- Number of queries
-
get
public java.lang.Object get(java.lang.String queryKey)
Description copied from interface:QueryDatastoreCompilationCache
Accessor for a (generic) compilation from the cache.- Specified by:
get
in interfaceQueryDatastoreCompilationCache
- Parameters:
queryKey
- The query key- Returns:
- The cached query compilation
-
put
public java.lang.Object put(java.lang.String queryKey, java.lang.Object compilation)
Description copied from interface:QueryDatastoreCompilationCache
Method to put an object in the cache.- Specified by:
put
in interfaceQueryDatastoreCompilationCache
- Parameters:
queryKey
- The query keycompilation
- The compilation for this datastore- Returns:
- The cached compilation previously associated with this query (if any)
-
contains
public boolean contains(java.lang.String queryKey)
Description copied from interface:QueryDatastoreCompilationCache
Accessor for whether the specified query is in the cache- Specified by:
contains
in interfaceQueryDatastoreCompilationCache
- Parameters:
queryKey
- The query key- Returns:
- Whether it is in the cache
-
-