public interface QueryCache extends TypesChangedListener, Closeable
Configurable
to receive a handle to the
system configuration on construction.Modifier and Type | Method and Description |
---|---|
void |
addTypesChangedListener(TypesChangedListener listen)
Add a new types event listener to this cache.
|
void |
clear()
Remove all data from this cache.
|
void |
close()
Free the resources used by this cache.
|
QueryResult |
get(QueryKey qk)
Return a list of oids for the given query key.
|
QueryStatistics<QueryKey> |
getStatistics()
Gets the simple statistics for query results.
|
void |
initialize(DataCacheManager manager)
Initialize any resources associated with the given
DataCacheManager . |
boolean |
pin(QueryKey qk)
Pin the value stored under
qk into the
cache. |
QueryResult |
put(QueryKey qk,
QueryResult oids)
Set the list of OIDs for the given query key.
|
QueryResult |
remove(QueryKey qk)
Remove the value stored under the given query key.
|
boolean |
removeTypesChangedListener(TypesChangedListener listen)
Remove an types event listener from this cache.
|
boolean |
unpin(QueryKey qk)
Unpin the value stored under
key into the cache. |
void |
writeLock()
Obtain a write lock on the cache.
|
void |
writeUnlock()
Release the write lock on the cache.
|
onTypesChanged
void initialize(DataCacheManager manager)
DataCacheManager
.QueryResult get(QueryKey qk)
QueryResult put(QueryKey qk, QueryResult oids)
null
if
the key was not previously cached. See Map.put(K, V)
for more information.QueryResult remove(QueryKey qk)
QueryCache
class. Instead, the cache should
be updated by implementing RemoteCommitListener
,
which will result in all queries that may be invalid being dropped.null
if
the key was not previously cached. See Map.remove(java.lang.Object)
for more information.void clear()
boolean pin(QueryKey qk)
qk
into the
cache. This method guarantees that qk
's value
will not be expired if the cache exceeds its capacity. It
causes this data to be ignored when determining whether or not
the cache is full, effectively increasing the total amount of
data stored in the cache. This method does not affect the
behavior of remove(org.apache.openjpa.datacache.QueryKey)
or TypesChangedListener.onTypesChanged(org.apache.openjpa.datacache.TypesChangedEvent)
.true
if key
's value was
pinned into the cache; false
if the key is not in the cache.boolean unpin(QueryKey qk)
key
into the cache.
This method reverses a previous invocation of pin(org.apache.openjpa.datacache.QueryKey)
.
This method does not remove anything from the cache; it merely
makes key
's value a candidate for flushing from the cache.true
if key
's value was
unpinned from the cache; false
if the
key is not in the cache.void writeLock()
void writeUnlock()
void addTypesChangedListener(TypesChangedListener listen)
boolean removeTypesChangedListener(TypesChangedListener listen)
void close()
QueryStatistics<QueryKey> getStatistics()
Copyright © 2006–2020 Apache Software Foundation. All rights reserved.