org.datanucleus.store.query.cache
Class AbstractQueryDatastoreCompilationCache

java.lang.Object
  extended by org.datanucleus.store.query.cache.AbstractQueryDatastoreCompilationCache
All Implemented Interfaces:
QueryDatastoreCompilationCache
Direct Known Subclasses:
SoftQueryDatastoreCompilationCache, StrongQueryDatastoreCompilationCache, WeakQueryDatastoreCompilationCache

public class AbstractQueryDatastoreCompilationCache
extends java.lang.Object
implements QueryDatastoreCompilationCache

Abstract representation of a query compilation cache for the query specific to the datastore.


Constructor Summary
AbstractQueryDatastoreCompilationCache()
           
 
Method Summary
 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 cache
 void 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractQueryDatastoreCompilationCache

public AbstractQueryDatastoreCompilationCache()
Method Detail

clear

public void clear()
Description copied from interface: QueryDatastoreCompilationCache
Method to clear the cache.

Specified by:
clear in interface QueryDatastoreCompilationCache

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 interface QueryDatastoreCompilationCache

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 interface QueryDatastoreCompilationCache
Parameters:
queryKey - The query key
Returns:
Whether it is in the cache

evict

public void evict(java.lang.String queryKey)
Description copied from interface: QueryDatastoreCompilationCache
Evict the query from the compilation cache.

Specified by:
evict in interface QueryDatastoreCompilationCache
Parameters:
queryKey - Key for the query to evict.

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 interface QueryDatastoreCompilationCache
Parameters:
queryKey - The query key
Returns:
The cached query compilation

isEmpty

public boolean isEmpty()
Description copied from interface: QueryDatastoreCompilationCache
Accessor for whether the cache is empty.

Specified by:
isEmpty in interface QueryDatastoreCompilationCache
Returns:
Whether it is empty.

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 interface QueryDatastoreCompilationCache
Parameters:
queryKey - The query key
compilation - The compilation for this datastore
Returns:
The cached compilation previously associated with this query (if any)

size

public int size()
Description copied from interface: QueryDatastoreCompilationCache
Accessor for the total number of compilations in the query cache.

Specified by:
size in interface QueryDatastoreCompilationCache
Returns:
Number of queries


Copyright © 2011. All Rights Reserved.