org.datanucleus.store.query.cache
Interface QueryResultsCache

All Known Implementing Classes:
AbstractQueryResultsCache, SoftQueryResultsCache, StrongQueryResultsCache, WeakQueryResultsCache

public interface QueryResultsCache

Cache for query results.


Method Summary
 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(Query query)
          Evict the query from the results cache.
 void evict(Query query, java.util.Map params)
          Evict the query with the specified params from the results cache.
 void evictAll()
          Method to clear the cache.
 java.util.List<java.lang.Object> get(java.lang.String queryKey)
          Accessor for the results from the cache.
 boolean isEmpty()
          Accessor for whether the cache is empty.
 void pin(Query query)
          Method to pin the specified query in the cache, preventing garbage collection.
 void pin(Query query, java.util.Map params)
          Method to pin the specified query in the cache, preventing garbage collection.
 java.util.List<java.lang.Object> put(java.lang.String queryKey, java.util.List<java.lang.Object> results)
          Method to put an object in the cache.
 int size()
          Accessor for the total number of results in the query cache.
 void unpin(Query query)
          Method to unpin the specified query from the cache, allowing garbage collection.
 void unpin(Query query, java.util.Map params)
          Method to unpin the specified query from the cache, allowing garbage collection.
 

Method Detail

close

void close()
Method to close the cache when no longer needed. Provides a hook to release resources etc.


evict

void evict(Query query)
Evict the query from the results cache.

Parameters:
query - The query to evict (evicts all use of this query, with any params)

evict

void evict(Query query,
           java.util.Map params)
Evict the query with the specified params from the results cache.

Parameters:
query - The query to evict
params - The parameters

evictAll

void evictAll()
Method to clear the cache.


pin

void pin(Query query)
Method to pin the specified query in the cache, preventing garbage collection.

Parameters:
query - The query

pin

void pin(Query query,
         java.util.Map params)
Method to pin the specified query in the cache, preventing garbage collection.

Parameters:
query - The query
params - Its params

unpin

void unpin(Query query)
Method to unpin the specified query from the cache, allowing garbage collection.

Parameters:
query - The query

unpin

void unpin(Query query,
           java.util.Map params)
Method to unpin the specified query from the cache, allowing garbage collection.

Parameters:
query - The query
params - Its params

isEmpty

boolean isEmpty()
Accessor for whether the cache is empty.

Returns:
Whether it is empty.

size

int size()
Accessor for the total number of results in the query cache.

Returns:
Number of queries

get

java.util.List<java.lang.Object> get(java.lang.String queryKey)
Accessor for the results from the cache.

Parameters:
queryKey - The query key
Returns:
The cached query result ids

put

java.util.List<java.lang.Object> put(java.lang.String queryKey,
                                     java.util.List<java.lang.Object> results)
Method to put an object in the cache.

Parameters:
queryKey - The query key
results - The results for this query
Returns:
The result ids previously associated with this query (if any)

contains

boolean contains(java.lang.String queryKey)
Accessor for whether the specified query is in the cache

Parameters:
queryKey - The query key
Returns:
Whether it is in the cache


Copyright © 2011. All Rights Reserved.