NAME_DEFAULT| Constructor and Description |
|---|
DelegatingDataCache(DataCache cache)
Constructor.
|
DelegatingDataCache(DataCache cache,
RuntimeExceptionTranslator trans) |
| Modifier and Type | Method and Description |
|---|---|
void |
addExpirationListener(ExpirationListener listen)
Add a new expiration event listener to this cache.
|
void |
clear()
Remove all data from this cache.
|
void |
close()
Free the resources used by this cache.
|
void |
commit(Collection<DataCachePCData> additions,
Collection<DataCachePCData> newUpdates,
Collection<DataCachePCData> existingUpdates,
Collection<Object> deletes)
Perform a batch update of the cache.
|
boolean |
contains(Object oid)
Returns
true if this cache contains data
corresponding to oid; otherwise returns
false. |
BitSet |
containsAll(Collection<Object> oids)
Returns the indexes of the oids in this cache.
|
boolean |
equals(Object other) |
DataCachePCData |
get(Object oid)
Return the cached object for the given oid.
|
Map<Object,DataCachePCData> |
getAll(List<Object> keys)
Gets objects from the caches for a given list of keys.
|
DataCache |
getDelegate()
Return the direct delegate.
|
boolean |
getEvictOnBulkUpdate()
Returns whether the the cache needs to be updated when bulk updates as executed.
|
DataCache |
getInnermostDelegate()
Return the native delegate.
|
String |
getName()
Returns a string name that can be used by end-user-visible
code to identify this cache.
|
DataCache |
getPartition(String name,
boolean create)
Gets the named partition.
|
Set<String> |
getPartitionNames()
Gets the name of the known partitions.
|
CacheStatistics |
getStatistics()
Returns number of read/write request and cache hit ratio data.
|
int |
hashCode() |
void |
initialize(DataCacheManager manager)
Initialize any resources associated with the given
DataCacheManager. |
boolean |
isPartitioned()
Affirms if this cache maintains partitions.
|
boolean |
pin(Object oid)
Pin the value stored under
oid into the cache. |
void |
pinAll(Class<?> cls,
boolean subs)
Pin all oids for the given type.
|
BitSet |
pinAll(Collection<Object> oids)
Pin all oids to the cache.
|
DataCachePCData |
put(DataCachePCData value)
Set the cached value for the given instance.
|
DataCachePCData |
remove(Object oid)
Remove the value stored under the given oid.
|
void |
removeAll(Class<?> cls,
boolean subclasses)
Evict all values of a specified type.
|
BitSet |
removeAll(Collection<Object> oids)
Remove the values stored under the given oids.
|
boolean |
removeExpirationListener(ExpirationListener listen)
Remove an expiration event listener from this cache.
|
void |
setName(String name)
Sets a string name to be used to identify this cache to end-user needs.
|
protected RuntimeException |
translate(RuntimeException re)
Translate the OpenJPA exception.
|
boolean |
unpin(Object oid)
Unpin the value stored under
oid from the cache. |
void |
unpinAll(Class<?> cls,
boolean subs)
Unpin all oids associaed with the given type from the cache.
|
BitSet |
unpinAll(Collection<Object> oids)
Unpin all oids from the cache.
|
void |
update(DataCachePCData value)
Update the cached value for the given instance.
|
void |
writeLock()
Obtain a write lock on the cache.
|
void |
writeUnlock()
Release the write lock on the cache.
|
public DelegatingDataCache(DataCache cache)
public DelegatingDataCache(DataCache cache, RuntimeExceptionTranslator trans)
public DataCache getDelegate()
public DataCache getInnermostDelegate()
protected RuntimeException translate(RuntimeException re)
public String getName()
DataCachepublic void setName(String name)
DataCachepublic void initialize(DataCacheManager manager)
DataCacheDataCacheManager.initialize in interface DataCachepublic void commit(Collection<DataCachePCData> additions, Collection<DataCachePCData> newUpdates, Collection<DataCachePCData> existingUpdates, Collection<Object> deletes)
DataCacheDataCachePCData
objects in additions and in
newUpdates, make the appropriate modifications to
all DataCachePCDatas in existingUpdates, and delete all
OIDs in deletes.
All changes made to cached data must be made via this
method. It is this method that is responsible for performing
any side-effects that should happen on meaningful cache changes.
Implementations should bear in mind that the
deletes collection may contain oids that are also
in the additions map. This is possible because it
is valid for a user to delete an object with a particular oid
and then add that object in the same batch.commit in interface DataCacheadditions - A collection of DataCachePCData objects.
These represent data that have been newly created,
and thus must be added to the cache.newUpdates - A collection of DataCachePCData objects.
These represent data that have been modified but
were not originally in the cache, and thus must be added to the cache.existingUpdates - A collection of DataCachePCData objects.
These represent data that have been modified and
were originally loaded from the cache. It is
up to the cache implementation to decide if
these values must be re-enlisted in the cache.
Some caches may return live data from DataCache.get(java.lang.Object)
invocations, in which case these values need not be re-enlisted.deletes - A collection of object IDs that have been deleted
and must therefore be dropped from the cache.public boolean contains(Object oid)
DataCachetrue if this cache contains data
corresponding to oid; otherwise returns
false.public BitSet containsAll(Collection<Object> oids)
DataCachecontainsAll in interface DataCachepublic DataCachePCData get(Object oid)
DataCacheDataCache.update(org.apache.openjpa.datacache.DataCachePCData)
method should be used to re-cache any changed objects.public DataCachePCData put(DataCachePCData value)
DataCacheDataCache.commit(java.util.Collection<org.apache.openjpa.datacache.DataCachePCData>, java.util.Collection<org.apache.openjpa.datacache.DataCachePCData>, java.util.Collection<org.apache.openjpa.datacache.DataCachePCData>, java.util.Collection<java.lang.Object>) method.put in interface DataCachenull if
the value was not previously cached. See Map.put(K, V)
for more information.public void update(DataCachePCData value)
DataCacheDataCache.commit(java.util.Collection<org.apache.openjpa.datacache.DataCachePCData>, java.util.Collection<org.apache.openjpa.datacache.DataCachePCData>, java.util.Collection<org.apache.openjpa.datacache.DataCachePCData>, java.util.Collection<java.lang.Object>) method.
A cache implementation may or may not return a live object
from DataCache.get(java.lang.Object) invocations. If an object retrieved from a
DataCache.get(java.lang.Object) operation needs to be updated, this method can be
invoked instead of invoking DataCache.put(org.apache.openjpa.datacache.DataCachePCData). The DataCache implementation
can then make optimizations based on how its DataCache.get(java.lang.Object) method works.public DataCachePCData remove(Object oid)
DataCacheDataCache.commit(java.util.Collection<org.apache.openjpa.datacache.DataCachePCData>, java.util.Collection<org.apache.openjpa.datacache.DataCachePCData>, java.util.Collection<org.apache.openjpa.datacache.DataCachePCData>, java.util.Collection<java.lang.Object>) method.remove in interface DataCachenull if
the oid was not previously cached. See Map.remove(java.lang.Object)
for more information.public BitSet removeAll(Collection<Object> oids)
DataCacheremoveAll in interface DataCacheDataCache.remove(java.lang.Object)public void removeAll(Class<?> cls, boolean subclasses)
DataCachepublic void clear()
DataCacheDataCache.commit(java.util.Collection<org.apache.openjpa.datacache.DataCachePCData>, java.util.Collection<org.apache.openjpa.datacache.DataCachePCData>, java.util.Collection<org.apache.openjpa.datacache.DataCachePCData>, java.util.Collection<java.lang.Object>) method.public boolean pin(Object oid)
DataCacheoid into the cache.
This method guarantees that oid's value will not
be dropped by the caching algorithm. This method does not
affect the behavior of DataCache.remove(java.lang.Object).public BitSet pinAll(Collection<Object> oids)
DataCachepinAll in interface DataCacheDataCache.pin(java.lang.Object)public void pinAll(Class<?> cls, boolean subs)
DataCachepublic boolean unpin(Object oid)
DataCacheoid from the cache.
This method reverses a previous invocation of DataCache.pin(java.lang.Object).
This method does not remove anything from the cache; it merely
makes oid's value a candidate for flushing from the cache.public BitSet unpinAll(Collection<Object> oids)
DataCacheunpinAll in interface DataCacheDataCache.unpin(java.lang.Object)public void unpinAll(Class<?> cls, boolean subs)
DataCachepublic void writeLock()
DataCachepublic void writeUnlock()
DataCachewriteUnlock in interface DataCachepublic void addExpirationListener(ExpirationListener listen)
DataCacheaddExpirationListener in interface DataCachepublic boolean removeExpirationListener(ExpirationListener listen)
DataCacheremoveExpirationListener in interface DataCachepublic void close()
DataCachepublic Map<Object,DataCachePCData> getAll(List<Object> keys)
DataCachepublic CacheStatistics getStatistics()
DataCachegetStatistics in interface DataCachepublic DataCache getPartition(String name, boolean create)
DataCachegetPartition in interface DataCachename - name of the given partition.create - if true optionally create a new partition.public Set<String> getPartitionNames()
DataCachegetPartitionNames in interface DataCachepublic boolean isPartitioned()
DataCacheisPartitioned in interface DataCachepublic boolean getEvictOnBulkUpdate()
DataCachegetEvictOnBulkUpdate in interface DataCacheCopyright © 2006–2020 Apache Software Foundation. All rights reserved.