|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.tangosol.util.Base
com.tangosol.net.cache.CachingMap
com.tangosol.net.cache.NearCache
public class NearCache
A "near cache" is a CachingMap whose front map is a size-limited and/or auto-expiring local cache, and whose back map is a distributed cache. (A CachingMap is a map that has a "front" map and a "back" map; the front map is assumed to be low latency but incomplete, and the back map is assumed to be complete but high latency.)
Invalidation strategies| Nested Class Summary | |
|---|---|
protected class |
NearCache.BackServiceListener
MemberListener for the back cache's service. |
| Nested classes/interfaces inherited from class com.tangosol.net.cache.CachingMap |
|---|
CachingMap.BackMapListener, CachingMap.FrontMapListener |
| Nested classes/interfaces inherited from interface com.tangosol.util.QueryMap |
|---|
QueryMap.Entry |
| Nested classes/interfaces inherited from interface com.tangosol.util.InvocableMap |
|---|
InvocableMap.Entry, InvocableMap.EntryAggregator, InvocableMap.EntryProcessor, InvocableMap.ParallelAwareAggregator |
| Field Summary | |
|---|---|
protected MemberListener |
m_listenerBackService
The back cache service MemberListener. |
| Fields inherited from class com.tangosol.net.cache.CachingMap |
|---|
LISTEN_ALL, LISTEN_AUTO, LISTEN_NONE, LISTEN_PRESENT, m_nStrategyCurrent, m_nStrategyTarget |
| Fields inherited from interface com.tangosol.net.cache.CacheMap |
|---|
EXPIRY_DEFAULT, EXPIRY_NEVER |
| Fields inherited from interface com.tangosol.util.ConcurrentMap |
|---|
LOCK_ALL |
| Constructor Summary | |
|---|---|
NearCache(Map mapFront,
NamedCache mapBack)
Construct a NearCache, using a mapBack NamedCache as the complete (back) storage and mapFront Map as a near (front) storage using the CachingMap.LISTEN_AUTO invalidation strategy. |
|
NearCache(Map mapFront,
NamedCache mapBack,
int nStrategy)
Construct a NearCache, using a mapBack NamedCache as the complete (back) storage and mapFront Map as a near (front) storage. |
|
| Method Summary | |
|---|---|
void |
addIndex(ValueExtractor extractor,
boolean fOrdered,
Comparator comparator)
Add an index to this QueryMap. |
void |
addMapListener(MapListener listener)
Add a standard map listener. |
void |
addMapListener(MapListener listener,
Filter filter,
boolean fLite)
Add a map listener that receives events based on a filter evaluation. |
void |
addMapListener(MapListener listener,
Object oKey,
boolean fLite)
Add a map listener for a specific key. |
Object |
aggregate(Collection collKeys,
InvocableMap.EntryAggregator agent)
Perform an aggregating operation against the entries specified by the passed keys. |
Object |
aggregate(Filter filter,
InvocableMap.EntryAggregator agent)
Perform an aggregating operation against the set of entries that are selected by the given Filter. |
void |
destroy()
Release and destroy this instance of NamedCache. |
Set |
entrySet(Filter filter)
Return a set view of the entries contained in this map that satisfy the criteria expressed by the filter. |
Set |
entrySet(Filter filter,
Comparator comparator)
Return a set view of the entries contained in this map that satisfy the criteria expressed by the filter. |
NamedCache |
getBackCache()
Obtain the NamedCache object that sits behind this NearCache. |
String |
getCacheName()
Return the cache name. |
CacheService |
getCacheService()
Return the CacheService that this NamedCache is a part of. |
Object |
invoke(Object oKey,
InvocableMap.EntryProcessor agent)
Invoke the passed EntryProcessor against the Entry specified by the passed key, returning the result of the invocation. |
Map |
invokeAll(Collection collKeys,
InvocableMap.EntryProcessor agent)
Invoke the passed EntryProcessor against the entries specified by the passed keys, returning the result of the invocation for each. |
Map |
invokeAll(Filter filter,
InvocableMap.EntryProcessor agent)
Invoke the passed EntryProcessor against the set of entries that are selected by the given Filter, returning the result of the invocation for each. |
boolean |
isActive()
Specifies whether or not the NamedCache is active. |
Set |
keySet(Filter filter)
Return a set view of the keys contained in this map for entries that satisfy the criteria expressed by the filter. |
boolean |
lock(Object oKey)
Attempt to lock the specified item and return immediately. |
boolean |
lock(Object oKey,
long lMillis)
Attempt to lock the specified item within the specified period of time. |
Object |
put(Object oKey,
Object oValue,
long cMillis)
Associates the specified value with the specified key in this cache and allows to specify an expiry for the cache entry. |
protected MemberListener |
registerBackServiceListener()
Instantiate and register a MemberListener with the back caches's service. |
void |
release()
Release resources associated with this instance of NamedCache. |
void |
removeIndex(ValueExtractor extractor)
Remove an index from this QueryMap. |
void |
removeMapListener(MapListener listener)
Remove a standard map listener. |
void |
removeMapListener(MapListener listener,
Filter filter)
Remove a map listener that previously signed up for events based on a filter evaluation. |
void |
removeMapListener(MapListener listener,
Object oKey)
Remove a map listener that previously signed up for events about a specific key. |
boolean |
unlock(Object oKey)
Unlock the specified item. |
protected void |
unregisterBackServiceListener()
Unregister back caches's service member listener. |
| Methods inherited from interface com.tangosol.net.cache.CacheMap |
|---|
getAll, put |
| Methods inherited from interface com.tangosol.util.ConcurrentMap |
|---|
clear, containsKey, containsValue, get, isEmpty, put, putAll, remove, size |
| Field Detail |
|---|
protected MemberListener m_listenerBackService
| Constructor Detail |
|---|
public NearCache(Map mapFront,
NamedCache mapBack)
CachingMap.LISTEN_AUTO invalidation strategy.
mapFront - Map to put in front of the back cachemapBack - NamedCache to put behind the front cache
public NearCache(Map mapFront,
NamedCache mapBack,
int nStrategy)
mapFront - Map to put in front of the back cachemapBack - NamedCache to put behind the front cachenStrategy - specifies the strategy used for the front map
invalidation; valid values are:LISTEN_NONE,
LISTEN_PRESENT,
LISTEN_ALL,
LISTEN_AUTO| Method Detail |
|---|
public NamedCache getBackCache()
IllegalStateException - if this NamedCache has been releasedpublic String getCacheName()
getCacheName in interface NamedCachepublic CacheService getCacheService()
getCacheService in interface NamedCachepublic boolean isActive()
isActive in interface NamedCachepublic void release()
release in interface NamedCacherelease in class CachingMapCacheService.releaseCache(NamedCache)public void destroy()
destroy in interface NamedCacheCacheService.destroyCache(NamedCache)public void addMapListener(MapListener listener)
addMapListener in interface ObservableMaplistener - the MapEvent listener to addpublic void removeMapListener(MapListener listener)
removeMapListener in interface ObservableMaplistener - the MapEvent listener to remove
public void addMapListener(MapListener listener,
Object oKey,
boolean fLite)
addMapListener in interface ObservableMaplistener - the listener to addoKey - the key that identifies the entry for which to raise
eventsfLite - true to indicate that the MapEvent objects do
not have to include the OldValue and NewValue
property values in order to allow optimizations
public void removeMapListener(MapListener listener,
Object oKey)
removeMapListener in interface ObservableMaplistener - the listener to removeoKey - the key that identifies the entry for which to raise
events
public void addMapListener(MapListener listener,
Filter filter,
boolean fLite)
addMapListener in interface ObservableMaplistener - the listener to addfilter - a filter that will be passed MapEvent objects to
select from; a MapEvent will be delivered to the
listener only if the filter evaluates to true for
that MapEvent; null is equivalent to a filter
that alway returns truefLite - true to indicate that the MapEvent objects do
not have to include the OldValue and NewValue
property values in order to allow optimizations
public void removeMapListener(MapListener listener,
Filter filter)
removeMapListener in interface ObservableMaplistener - the listener to removefilter - a filter used to evaluate events
public Object put(Object oKey,
Object oValue,
long cMillis)
put in interface CacheMapput in interface NamedCacheoKey - key with which the specified value is to be associatedoValue - value to be associated with the specified keycMillis - the number of milliseconds until the cache entry will
expire
UnsupportedOperationException - if the requested expiry is a
positive value and either the front map or the back map
implementations do not support the expiration functionalityCacheMap.put(Object oKey, Object oValue, long cMillis)public boolean lock(Object oKey)
lock in interface ConcurrentMapoKey - key being locked
public boolean lock(Object oKey,
long lMillis)
lock in interface ConcurrentMapoKey - key being lockedlMillis - the number of milliseconds to continue trying to obtain
a lock; pass zero to return immediately; pass -1 to block
the calling thread until the lock could be obtained
public boolean unlock(Object oKey)
unlock in interface ConcurrentMapoKey - key being unlocked
public Set keySet(Filter filter)
Map.keySet() method, the set returned by this method
may not be backed by the map, so changes to the set may not reflected
in the map, and vice-versa.
Note: When using the Coherence Enterprise Edition or Grid Edition,
the Partitioned Cache implements the QueryMap interface using the
Parallel Query feature. When using Coherence Standard Edition, the
Parallel Query feature is not available, resulting in lower performance
for most queries, and particularly when querying large data sets.
The operation always executes against the back cache.
keySet in interface QueryMapfilter - the Filter object representing the criteria that
the entries of this map should satisfy
public Set entrySet(Filter filter)
Map.Entry.
Unlike the Map.entrySet() method, the set returned by this method
may not be backed by the map, so changes to the set may not be reflected
in the map, and vice-versa.
Note: When using the Coherence Enterprise Edition or Grid
Edition, the Partitioned Cache implements the QueryMap interface using
the Parallel Query feature. When using Coherence Standard Edition, the
Parallel Query feature is not available, resulting in lower performance
for most queries, and particularly when querying large data sets.
The operation always executes against the back cache.
entrySet in interface QueryMapfilter - the Filter object representing the criteria that
the entries of this map should satisfy
public Set entrySet(Filter filter,
Comparator comparator)
Map.Entry. It is further guaranteed that
its iterator will traverse the set in such a way that the entry values
come up in ascending order, sorted by the specified Comparator or
according to the natural ordering (see Comparable).
Unlike the Map.entrySet() method, the set returned by this method
may not be backed by the map, so changes to the set may not be reflected
in the map, and vice-versa.
Note: When using the Coherence Enterprise Edition or Grid
Edition, the Partitioned Cache implements the QueryMap interface using
the Parallel Query feature. When using Coherence Standard Edition, the
Parallel Query feature is not available, resulting in lower performance
for most queries, and particularly when querying large data sets.
The operation always executes against the back cache.
entrySet in interface QueryMapfilter - the Filter object representing the criteria that
the entries of this map should satisfycomparator - the Comparator object which imposes an ordering
on entries in the resulting set; or null
if the entries' values natural ordering should be
used
ChainedComparator
public void addIndex(ValueExtractor extractor,
boolean fOrdered,
Comparator comparator)
The operation always executes against the back cache.
addIndex in interface QueryMapextractor - the ValueExtractor object that is used to extract an
indexable Object from a value stored in the indexed
Map. Must not be null.fOrdered - true iff the contents of the indexed information
should be ordered; false otherwisecomparator - the Comparator object which imposes an ordering
on entries in the indexed map; or null
if the entries' values natural ordering should be
usedReflectionExtractor,
ChainedComparatorpublic void removeIndex(ValueExtractor extractor)
The operation always executes against the back cache.
removeIndex in interface QueryMapextractor - the ValueExtractor object that is used to extract an
indexable Object from a value stored in the Map.
public Object invoke(Object oKey,
InvocableMap.EntryProcessor agent)
The operation always executes against the back cache.
invoke in interface InvocableMapoKey - the key to process; it is not required to exist within
the Mapagent - the EntryProcessor to use to process the specified key
public Map invokeAll(Collection collKeys,
InvocableMap.EntryProcessor agent)
The operation always executes against the back cache.
invokeAll in interface InvocableMapcollKeys - the keys to process; these keys are not required to
exist within the Mapagent - the EntryProcessor to use to process the specified keys
public Map invokeAll(Filter filter,
InvocableMap.EntryProcessor agent)
ConditionalProcessor.
The operation always executes against the back cache.
invokeAll in interface InvocableMapfilter - a Filter that results in the set of keys to be processedagent - the EntryProcessor to use to process the specified keys
public Object aggregate(Collection collKeys,
InvocableMap.EntryAggregator agent)
The operation always executes against the back cache.
aggregate in interface InvocableMapcollKeys - the Collection of keys that specify the entries within
this Map to aggregate acrossagent - the EntryAggregator that is used to aggregate across
the specified entries of this Map
public Object aggregate(Filter filter,
InvocableMap.EntryAggregator agent)
The operation always executes against the back cache.
aggregate in interface InvocableMapfilter - the Filter that is used to select entries within this
Map to aggregate acrossagent - the EntryAggregator that is used to aggregate across
the selected entries of this Map
protected MemberListener registerBackServiceListener()
The primary goal of that listener is invalidation of the front map in case of the service [automatic] restart.
protected void unregisterBackServiceListener()
|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||