Oracle Coherence for C++ API
Release 3.6.1.0

E18813-01

ConverterCollections::ConverterNamedCache Class Reference

#include <coherence/util/ConverterCollections.hpp>

Inherits ConverterCollections::ConverterCacheMap, and NamedCache.

List of all members.


Detailed Description

A ConverterNamedCache views an underlying NamedCache through a set of key and value Converters.

Public Types

typedef spec::Handle  Handle
  ConverterNamedCache Handle definition.
typedef spec::View  View
  ConverterNamedCache View definition.
typedef spec::Holder  Holder
  ConverterNamedCache Holder definition.

Public Member Functions

virtual String::View  getCacheName () const
  Return the cache name.
virtual
CacheService::Handle 
getCacheService ()
  Return the CacheService that this NamedCache is a part of.
virtual
CacheService::View 
getCacheService () const
  Return the CacheService that this NamedCache is a part of.
virtual bool  isActive () const
  Specifies whether or not the NamedCache is active.
virtual void  release ()
  Release local resources associated with this instance of NamedCache.
virtual void  destroy ()
  Release and destroy this instance of NamedCache.
virtual bool  lock (Object::View vKey, int64_t cWait) const
  Attempt to lock the specified item within the specified period of time.

The item doesn't have to exist to be locked. While the item is locked there is known to be a lock holder which has an exclusive right to modify (calling put and remove methods) that item.

Lock holder is an abstract concept that depends on the ConcurrentMap implementation. For example, holder could be a process or a thread (or both).

Locking strategy may vary for concrete implementations as well. Lock could have an expiration time (this lock is sometimes called a "lease") or be held indefinitely (until the lock holder terminates).

Some implementations may allow the entire map to be locked. If the map is locked in such a way, then only a lock holder is allowed to perform any of the "put" or "remove" operations. Pass the special constant getLockAll() as the vKey parameter to indicate the map lock.

Parameters:
vKey  key being locked
cWait  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
Returns:
true if the item was successfully locked within the specified time; false otherwise

virtual bool  lock (Object::View vKey) const
  Attempt to lock the specified item and return immediately.

This method behaves exactly as if it simply performs the call lock(vKey, 0).

Parameters:
vKey  key being locked
Returns:
true if the item was successfully locked; false otherwise

virtual bool  unlock (Object::View vKey) const
  Unlock the specified item.

The item doesn't have to exist to be unlocked. If the item is currently locked, only the holder of the lock could successfully unlock it.

Parameters:
vKey  key being unlocked
Returns:
true if the item was successfully unlocked; false otherwise

virtual Object::Holder  invoke (Object::View vKey, InvocableMap::EntryProcessor::Handle hAgent)
  Invoke the passed EntryProcessor against the Entry specified by the passed key, returning the result of the invocation.
Parameters:
vKey  the key to process; it is not required to exist within the Map
hAgent  the EntryProcessor to use to process the specified key
Returns:
the result of the invocation as returned from the EntryProcessor

virtual Map::View  invokeAll (Collection::View vCollKeys, InvocableMap::EntryProcessor::Handle hAgent)
  Invoke the passed EntryProcessor against the entries specified by the passed keys, returning the result of the invocation for each.
Parameters:
vCollKeys  the keys to process; these keys are not required to exist within the Map
hAgent  the EntryProcessor to use to process the specified keys
Returns:
a Map containing the results of invoking the EntryProcessor against each of the specified keys

virtual Map::View  invokeAll (Filter::View vFilter, InvocableMap::EntryProcessor::Handle hAgent)
  Invoke the passed EntryProcessor against the entries specified by the passed keys, returning the result of the invocation for each.
Parameters:
vCollKeys  the keys to process; these keys are not required to exist within the Map
hAgent  the EntryProcessor to use to process the specified keys
Returns:
a Map containing the results of invoking the EntryProcessor against each of the specified keys

virtual Object::Holder  aggregate (Collection::View vCollKeys, InvocableMap::EntryAggregator::Handle hAgent) const
  Perform an aggregating operation against the entries specified by the passed keys.
Parameters:
vCollKeys  the Collection of keys that specify the entries within this Map to aggregate across
hAgent  the EntryAggregator that is used to aggregate across the specified entries of this Map
Returns:
the result of the aggregation

virtual Object::Holder  aggregate (Filter::View vFilter, InvocableMap::EntryAggregator::Handle hAgent) const
  Perform an aggregating operation against the entries specified by the passed keys.
Parameters:
vCollKeys  the Collection of keys that specify the entries within this Map to aggregate across
hAgent  the EntryAggregator that is used to aggregate across the specified entries of this Map
Returns:
the result of the aggregation

virtual Set::View  keySet (Filter::View vFilter) const
  Return a set of the keys contained in this map for entries that satisfy the criteria expressed by the filter.

Unlike the 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.

Parameters:
vFilter  the Filter object representing the criteria that the entries of this map should satisfy
Returns:
a set of keys for entries that satisfy the specified criteria

virtual Set::View  entrySet (Filter::View vFilter) const
  Return a set of the entries contained in this map that satisfy the criteria expressed by the filter.

Each element in the returned set is a 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.

Parameters:
vFilter  the Filter object representing the criteria that the entries of this map should satisfy
Returns:
a set of entries that satisfy the specified criteria

virtual Set::View  entrySet (Filter::View vFilter, Comparator::View vComparator) const
  Return a set of the entries contained in this map that satisfy the criteria expressed by the filter.

Each element in the returned set is a 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.

Parameters:
vFilter  the Filter object representing the criteria that the entries of this map should satisfy
vComparator  the Comparator object which imposes an ordering on entries in the resulting set; or NULL if the entries' values natural ordering should be used
Returns:
a set of entries that satisfy the specified criteria

virtual void  addIndex (ValueExtractor::View vExtractor, bool fOrdered, Comparator::View vComparator)
  Add an index to this QueryMap.

This allows to correlate values stored in this indexed Map (or attributes of those values) to the corresponding keys in the indexed Map and increase the performance of keySet and entrySet methods.

This method is only intended as a hint to the cache implementation, and as such it may be ignored by the cache if indexes are not supported or if the desired index (or a similar index) already exists. It is expected that an application will call this method to suggest an index even if the index may already exist, just so that the application is certain that index has been suggested. For example in a distributed environment, each server will likely suggest the same set of indexes when it starts, and there is no downside to the application blindly requesting those indexes regardless of whether another server has already requested the same indexes.

Parameters:
vExtractor  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 otherwise
vComparator  the Comparator object which imposes an ordering on entries in the indexed map; or NULL if the entries' values natural ordering should be used

virtual void  removeIndex (ValueExtractor::View vExtractor)
  Remove an index from this QueryMap.
Parameters:
vExtractor  the ValueExtractor object that is used to extract an indexable Object from a value stored in the Map

virtual NamedCache::View  getNamedCache () const
  Return the underlying InvocableMap.
virtual
NamedCache::Handle 
getNamedCache ()
  Return the underlying CacheMap.
virtual
ConcurrentMap::View 
getConcurrentMap () const
  Return the underlying ConcurrentMap.
virtual
ConcurrentMap::Handle 
getConcurrentMap ()
  Return the underlying ConcurrentMap.
virtual
InvocableMap::View 
getInvocableMap () const
  Return the underlying InvocableMap.
virtual
InvocableMap::Handle 
getInvocableMap ()
  Return the underlying InvocableMap.
virtual QueryMap::View  getQueryMap () const
  Return the underlying QueryMap.
virtual QueryMap::Handle  getQueryMap ()
  Return the underlying QueryMap.

Protected Member Functions

  ConverterNamedCache (NamedCache::Handle hMapDelegate, EntryConverter::View vConvUp, EntryConverter::View vConvDown)
  Create a ConverterQueryMap which delegates to the s pecified QueryMap.
  ConverterNamedCache (NamedCache::View vMapDelegate, EntryConverter::View vConvUp, EntryConverter::View vConvDown)
  Create a ConverterQueryMap which delegates to the s pecified QueryMap.

Protected Attributes

FinalHolder
< ConverterConcurrentMap
m_ohMapConcurrent
  A Converter ConcurrentMap around the underlying NamedCache.
FinalHolder
< ConverterInvocableMap
m_ohMapInvocable
  A Converter InvocableMap around the underlying NamedCache.
FinalHolder
< ConverterQueryMap
m_ohMapQuery
  A Converter QueryMap around the underlying NamedCache.

Constructor & Destructor Documentation

ConverterNamedCache ( NamedCache::Handle  hMapDelegate,
EntryConverter::View  vConvUp,
EntryConverter::View  vConvDown  
) [protected]

Create a ConverterQueryMap which delegates to the s pecified QueryMap.

Parameters:
hMap  the specified InvocableMap
vConvUp  the EntryConverter from the underlying Map
vConvDown  the EntryConverter to the underlying Map

ConverterNamedCache ( NamedCache::View  vMapDelegate,
EntryConverter::View  vConvUp,
EntryConverter::View  vConvDown  
) [protected]

Create a ConverterQueryMap which delegates to the s pecified QueryMap.

Parameters:
vMap  the specified InvocableMap
vConvUp  the EntryConverter from the underlying Map
vConvDown  the EntryConverter to the underlying Map

Member Function Documentation

virtual String::View getCacheName (  )  const [virtual]

Return the cache name.

Returns:
the cache name

Implements NamedCache.

virtual CacheService::Handle getCacheService (  )  [virtual]

Return the CacheService that this NamedCache is a part of.

Returns:
the CacheService

Implements NamedCache.

virtual CacheService::View getCacheService (  )  const [virtual]

Return the CacheService that this NamedCache is a part of.

Returns:
the CacheService

Implements NamedCache.

virtual bool isActive (  )  const [virtual]

Specifies whether or not the NamedCache is active.

Returns:
true if the NamedCache is active; false otherwise

Implements NamedCache.

virtual void release (  )  [virtual]

Release local resources associated with this instance of NamedCache.

Releasing a cache makes it no longer usable, but does not affect the cache itself. In other words, all other references to the cache will still be valid, and the cache data is not affected by releasing the reference. Any attempt to use this reference afterword will result in an exception.

See also:
CacheService::releaseCache

Implements NamedCache.

virtual void destroy (  )  [virtual]

Release and destroy this instance of NamedCache.

Warning: This method is used to completely destroy the specified cache across the cluster. All references in the entire cluster to this cache will be invalidated, the cached data will be cleared, and all resources will be released.

See also:
CacheService::destroyCache

Implements NamedCache.

virtual NamedCache::View getNamedCache (  )  const [virtual]

Return the underlying InvocableMap.

Returns:
the underlying InvocableMap

virtual NamedCache::Handle getNamedCache (  )  [virtual]

Return the underlying CacheMap.

Returns:
the underlying CacheMap

virtual ConcurrentMap::View getConcurrentMap (  )  const [virtual]

Return the underlying ConcurrentMap.

Returns:
the underlying ConcurrentMap

virtual ConcurrentMap::Handle getConcurrentMap (  )  [virtual]

Return the underlying ConcurrentMap.

Returns:
the underlying ConcurrentMap

virtual InvocableMap::View getInvocableMap (  )  const [virtual]

Return the underlying InvocableMap.

Returns:
the underlying InvocableMap

virtual InvocableMap::Handle getInvocableMap (  )  [virtual]

Return the underlying InvocableMap.

Returns:
the underlying InvocableMap

virtual QueryMap::View getQueryMap (  )  const [virtual]

Return the underlying QueryMap.

Returns:
the underlying QueryMap

virtual QueryMap::Handle getQueryMap (  )  [virtual]

Return the underlying QueryMap.

Returns:
the underlying QueryMap

The documentation for this class was generated from the following file:
Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.