Show / Hide Table of Contents

Class ConverterCollections.ConverterNamedCache

A Converter NamedCache views an underlying INamedCache through a set of key and value IConverters.

Inheritance
object
ConverterCollections.ConverterDictionary
ConverterCollections.ConverterCache
ConverterCollections.ConverterNamedCache
Implements
INamedCache
IObservableCache
IConcurrentCache
IQueryCache
IInvocableCache
ICache
IDictionary
ICollection
IEnumerable
IDisposable
Inherited Members
ConverterCollections.ConverterCache.Cache
ConverterCollections.ConverterCache.GetAll(ICollection)
ConverterCollections.ConverterCache.Insert(object, object)
ConverterCollections.ConverterCache.Insert(object, object, long)
ConverterCollections.ConverterCache.InsertAll(IDictionary)
ConverterCollections.ConverterCache.Entries
ConverterCollections.ConverterCache.GetEnumerator()
ConverterCollections.ConverterCache.InstantiateEntries(ICollection, IConverter, IConverter, IConverter, IConverter)
ConverterCollections.ConverterCache.InstantiateCacheEnumerator(ICacheEnumerator, IConverter, IConverter, IConverter)
ConverterCollections.ConverterCache.m_entries
ConverterCollections.ConverterDictionary.Dictionary
ConverterCollections.ConverterDictionary.ConverterKeyUp
ConverterCollections.ConverterDictionary.ConverterKeyDown
ConverterCollections.ConverterDictionary.ConverterValueUp
ConverterCollections.ConverterDictionary.ConverterValueDown
ConverterCollections.ConverterDictionary.Contains(object)
ConverterCollections.ConverterDictionary.Add(object, object)
ConverterCollections.ConverterDictionary.Clear()
ConverterCollections.ConverterDictionary.Remove(object)
ConverterCollections.ConverterDictionary.this[object]
ConverterCollections.ConverterDictionary.Keys
ConverterCollections.ConverterDictionary.Values
ConverterCollections.ConverterDictionary.IsReadOnly
ConverterCollections.ConverterDictionary.IsFixedSize
ConverterCollections.ConverterDictionary.CopyTo(Array, int)
ConverterCollections.ConverterDictionary.Count
ConverterCollections.ConverterDictionary.SyncRoot
ConverterCollections.ConverterDictionary.IsSynchronized
ConverterCollections.ConverterDictionary.InstantiateCollection(ICollection, IConverter, IConverter)
ConverterCollections.ConverterDictionary.InstantiateDictionary(IDictionary, IConverter, IConverter, IConverter, IConverter)
ConverterCollections.ConverterDictionary.InstantiateDictionaryEnumerator(IDictionaryEnumerator, IConverter, IConverter)
ConverterCollections.ConverterDictionary.ToString()
ConverterCollections.ConverterDictionary.m_dictionary
ConverterCollections.ConverterDictionary.m_convKeyUp
ConverterCollections.ConverterDictionary.m_convKeyDown
ConverterCollections.ConverterDictionary.m_convValUp
ConverterCollections.ConverterDictionary.m_convValDown
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
Namespace: Tangosol.Util
Assembly: Coherence.dll
Syntax
[Serializable]
public class ConverterCollections.ConverterNamedCache : ConverterCollections.ConverterCache, INamedCache, IObservableCache, IConcurrentCache, IQueryCache, IInvocableCache, ICache, IDictionary, ICollection, IEnumerable, IDisposable

Constructors

ConverterNamedCache(INamedCache, IConverter, IConverter, IConverter, IConverter)

Constructor.

Declaration
public ConverterNamedCache(INamedCache cache, IConverter convKeyUp, IConverter convKeyDown, IConverter convValUp, IConverter convValDown)
Parameters
Type Name Description
INamedCache cache

The underlying INamedCache.

IConverter convKeyUp

The IConverter to view the underlying cache's keys through.

IConverter convKeyDown

The IConverter to use to pass keys down to the underlying cache.

IConverter convValUp

The IConverter to view the underlying cache's values through.

IConverter convValDown

The IConverter to use to pass values down to the underlying cache.

Fields

m_cacheConcurrent

A Converter ConcurrentCache around the underlying INamedCache.

Declaration
protected ConverterCollections.ConverterConcurrentCache m_cacheConcurrent
Field Value
Type Description
ConverterCollections.ConverterConcurrentCache

m_cacheInvocable

A Converter InvocableCache around the underlying INamedCache.

Declaration
protected ConverterCollections.ConverterInvocableCache m_cacheInvocable
Field Value
Type Description
ConverterCollections.ConverterInvocableCache

m_cacheObservable

A Converter ObservableCache aroung the underlying INamedCache.

Declaration
protected ConverterCollections.ConverterObservableCache m_cacheObservable
Field Value
Type Description
ConverterCollections.ConverterObservableCache

m_cacheQuery

A Converter QueryCache around the underlying INamedCache.

Declaration
protected ConverterCollections.ConverterQueryCache m_cacheQuery
Field Value
Type Description
ConverterCollections.ConverterQueryCache

Properties

CacheName

Gets the cache name.

Declaration
public virtual string CacheName { get; }
Property Value
Type Description
string

The cache name.

CacheService

Gets the ICacheService that this INamedCache is a part of.

Declaration
public virtual ICacheService CacheService { get; }
Property Value
Type Description
ICacheService

The cache service this INamedCache is a part of.

IsActive

Specifies whether or not the INamedCache is active.

Declaration
public virtual bool IsActive { get; }
Property Value
Type Description
bool

true if the INamedCache is active; false otherwise.

NamedCache

The underlying INamedCache.

Declaration
public virtual INamedCache NamedCache { get; }
Property Value
Type Description
INamedCache

The underlying INamedCache.

Methods

AddCacheListener(ICacheListener)

Add a standard cache listener that will receive all events (inserts, updates, deletes) that occur against the cache, with the key, old-value and new-value included.

Declaration
public virtual void AddCacheListener(ICacheListener listener)
Parameters
Type Name Description
ICacheListener listener

The ICacheListener to add.

Remarks

This has the same result as the following call:

AddCacheListener(listener, (IFilter) null, false);

AddCacheListener(ICacheListener, object, bool)

Add a cache listener for a specific key.

Declaration
public virtual void AddCacheListener(ICacheListener listener, object key, bool isLite)
Parameters
Type Name Description
ICacheListener listener

The ICacheListener to add.

object key

The key that identifies the entry for which to raise events.

bool isLite

true to indicate that the CacheEventArgs objects do not have to include the OldValue and NewValue property values in order to allow optimizations.

Remarks

The listeners will receive CacheEventArgs objects, but if isLite is passed as true, they might not contain the OldValue and NewValue properties.

To unregister the ICacheListener, use the RemoveCacheListener(ICacheListener, object) method.

AddCacheListener(ICacheListener, IFilter, bool)

Add a cache listener that receives events based on a filter evaluation.

Declaration
public virtual void AddCacheListener(ICacheListener listener, IFilter filter, bool isLite)
Parameters
Type Name Description
ICacheListener listener

The ICacheListener to add.

IFilter filter

A filter that will be passed CacheEventArgs objects to select from; a CacheEventArgs will be delivered to the listener only if the filter evaluates to true for that CacheEventArgs; null is equivalent to a filter that alway returns true.

bool isLite

true to indicate that the CacheEventArgs objects do not have to include the OldValue and NewValue property values in order to allow optimizations.

Remarks

The listeners will receive CacheEventArgs objects, but if isLite is passed as true, they might not contain the OldValue and NewValue properties.

To unregister the ICacheListener, use the RemoveCacheListener(ICacheListener, IFilter) method.

AddIndex(IValueExtractor, bool, IComparer)

Add an index to this IQueryCache.

Declaration
public virtual void AddIndex(IValueExtractor extractor, bool isOrdered, IComparer comparer)
Parameters
Type Name Description
IValueExtractor extractor

The IValueExtractor object that is used to extract an indexable object from a value stored in the indexed cache. Must not be null.

bool isOrdered

true if the contents of the indexed information should be ordered; false otherwise.

IComparer comparer

The IComparer object which imposes an ordering on entries in the indexed cache; or null if the entries' values natural ordering should be used.

Remarks

This allows to correlate values stored in this indexed cache (or attributes of those values) to the corresponding keys in the indexed dictionary and increase the performance of GetKeys and GetEntries methods.

Aggregate(ICollection, IEntryAggregator)

Perform an aggregating operation against the entries specified by the passed keys.

Declaration
public virtual object Aggregate(ICollection keys, IEntryAggregator agent)
Parameters
Type Name Description
ICollection keys

The collection of keys that specify the entries within this cache to aggregate across.

IEntryAggregator agent

The IEntryAggregator that is used to aggregate across the specified entries of this dictionary.

Returns
Type Description
object

The result of the aggregation.

Aggregate(IFilter, IEntryAggregator)

Perform an aggregating operation against the collection of entries that are selected by the given IFilter.

Declaration
public virtual object Aggregate(IFilter filter, IEntryAggregator agent)
Parameters
Type Name Description
IFilter filter

an IFilter that is used to select entries within this cache to aggregate across.

IEntryAggregator agent

The IEntryAggregator that is used to aggregate across the selected entries of this dictionary.

Returns
Type Description
object

The result of the aggregation.

Destroy()

Release and destroy this instance of INamedCache.

Declaration
public virtual void Destroy()
Remarks

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.

Dispose()

Calls Dispose() on the underlying cache to release the resources associated with the cache.

Declaration
public void Dispose()

GetEntries(IFilter)

Return a collection of the entries contained in this cache that satisfy the criteria expressed by the filter.

Declaration
public virtual ICacheEntry[] GetEntries(IFilter filter)
Parameters
Type Name Description
IFilter filter

The IFilter object representing the criteria that the entries of this cache should satisfy.

Returns
Type Description
ICacheEntry[]

A collection of entries that satisfy the specified criteria.

GetEntries(IFilter, IComparer)

Return a collection of the entries contained in this cache that satisfy the criteria expressed by the filter.

Declaration
public virtual ICacheEntry[] GetEntries(IFilter filter, IComparer comparer)
Parameters
Type Name Description
IFilter filter

The IFilter object representing the criteria that the entries of this cache should satisfy.

IComparer comparer

The IComparable object which imposes an ordering on entries in the resulting collection; or null if the entries' values natural ordering should be used.

Returns
Type Description
ICacheEntry[]

A collection of entries that satisfy the specified criteria.

Remarks

It is guaranteed that enumerator will traverse the array in such a way that the entry values come up in ascending order, sorted by the specified comparer or according to the natural ordering.

GetKeys(IFilter)

Return a collection of the keys contained in this cache for entries that satisfy the criteria expressed by the filter.

Declaration
public virtual object[] GetKeys(IFilter filter)
Parameters
Type Name Description
IFilter filter

The IFilter object representing the criteria that the entries of this cache should satisfy.

Returns
Type Description
object[]

A collection of keys for entries that satisfy the specified criteria.

GetValues(IFilter)

Return a collection of the values contained in this cache for entries that satisfy the criteria expressed by the filter.

Declaration
public virtual object[] GetValues(IFilter filter)
Parameters
Type Name Description
IFilter filter

The IFilter object representing the criteria that the entries of this cache should satisfy.

Returns
Type Description
object[]

A collection of the values for entries that satisfy the specified criteria.

GetValues(IFilter, IComparer)

Return a collection of the values contained in this cache for entries that satisfy the criteria expressed by the filter.

Declaration
public virtual object[] GetValues(IFilter filter, IComparer comparer)
Parameters
Type Name Description
IFilter filter

The IFilter object representing the criteria that the entries of this cache should satisfy.

IComparer comparer

The IComparable object which imposes an ordering on entries in the resulting collection; or null if the entries' values natural ordering should be used.

Returns
Type Description
object[]

A collection of entries that satisfy the specified criteria.

Remarks

It is guaranteed that enumerator will traverse the array in such a way that the values come up in ascending order, sorted by the specified comparer or according to the natural ordering.

Invoke(object, IEntryProcessor)

Invoke the passed IEntryProcessor against the entry specified by the passed key, returning the result of the invocation.

Declaration
public virtual object Invoke(object key, IEntryProcessor agent)
Parameters
Type Name Description
object key

The key to process; it is not required to exist within the dictionary.

IEntryProcessor agent

The IEntryProcessor to use to process the specified key.

Returns
Type Description
object

The result of the invocation as returned from the IEntryProcessor.

InvokeAll(ICollection, IEntryProcessor)

Invoke the passed IEntryProcessor against the entries specified by the passed keys, returning the result of the invocation for each.

Declaration
public virtual IDictionary InvokeAll(ICollection keys, IEntryProcessor agent)
Parameters
Type Name Description
ICollection keys

The keys to process; these keys are not required to exist within the dictionary.

IEntryProcessor agent

The IEntryProcessor to use to process the specified keys.

Returns
Type Description
IDictionary

A dictionary containing the results of invoking the IEntryProcessor against each of the specified keys.

InvokeAll(IFilter, IEntryProcessor)

Invoke the passed IEntryProcessor against the set of entries that are selected by the given IFilter, returning the result of the invocation for each.

Declaration
public virtual IDictionary InvokeAll(IFilter filter, IEntryProcessor agent)
Parameters
Type Name Description
IFilter filter

An IFilter that results in the collection of keys to be processed.

IEntryProcessor agent

The IEntryProcessor to use to process the specified keys.

Returns
Type Description
IDictionary

A dictionary containing the results of invoking the IEntryProcessor against the keys that are selected by the given IFilter.

Remarks

Unless specified otherwise, IInvocableCache implementations will perform this operation in two steps: (1) use the filter to retrieve a matching entry collection; (2) apply the agent to every filtered entry. This algorithm assumes that the agent's processing does not affect the result of the specified filter evaluation, since the filtering and processing could be performed in parallel on different threads.

If this assumption does not hold, the processor logic has to be idempotent, or at least re-evaluate the filter. This could be easily accomplished by wrapping the processor with the ConditionalProcessor.

Lock(object)

Attempt to lock the specified item and return immediately.

Declaration
public virtual bool Lock(object key)
Parameters
Type Name Description
object key

Key being locked.

Returns
Type Description
bool

true if the item was successfully locked; false otherwise.

Remarks

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

Lock(object, long)

Attempt to lock the specified item within the specified period of time.

Declaration
public virtual bool Lock(object key, long waitTimeMillis)
Parameters
Type Name Description
object key

Key being locked.

long waitTimeMillis

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
Type Description
bool

true if the item was successfully locked within the specified time; false otherwise.

Remarks

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 IConcurrentCache implementation. For example, holder could be a cluster member 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 cache to be locked. If the cache 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 LOCK_ALL as the key parameter to indicate the cache lock.

Release()

Release local resources associated with this instance of INamedCache.

Declaration
public virtual void Release()
Remarks

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.

RemoveCacheListener(ICacheListener)

Remove a standard cache listener that previously signed up for all events.

Declaration
public virtual void RemoveCacheListener(ICacheListener listener)
Parameters
Type Name Description
ICacheListener listener

The ICacheListener to remove.

Remarks

This has the same result as the following call:

RemoveCacheListener(listener, (IFilter) null);

RemoveCacheListener(ICacheListener, object)

Remove a cache listener that previously signed up for events about a specific key.

Declaration
public virtual void RemoveCacheListener(ICacheListener listener, object key)
Parameters
Type Name Description
ICacheListener listener

The listener to remove.

object key

The key that identifies the entry for which to raise events.

RemoveCacheListener(ICacheListener, IFilter)

Remove a cache listener that previously signed up for events based on a filter evaluation.

Declaration
public virtual void RemoveCacheListener(ICacheListener listener, IFilter filter)
Parameters
Type Name Description
ICacheListener listener

The ICacheListener to remove.

IFilter filter

A filter used to evaluate events; null is equivalent to a filter that alway returns true.

RemoveIndex(IValueExtractor)

Remove an index from this IQueryCache.

Declaration
public virtual void RemoveIndex(IValueExtractor extractor)
Parameters
Type Name Description
IValueExtractor extractor

The IValueExtractor object that is used to extract an indexable object from a value stored in the cache.

Truncate()

Removes all mappings from this map.

Declaration
public virtual void Truncate()
Remarks

Note: the removal of entries caused by this truncate operation will not be observable.

Unlock(object)

Unlock the specified item.

Declaration
public virtual bool Unlock(object key)
Parameters
Type Name Description
object key

Key being unlocked.

Returns
Type Description
bool

true if the item was successfully unlocked; false otherwise.

Remarks

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.

View()

Construct a view of this INamedCache.

Declaration
public virtual ViewBuilder View()
Returns
Type Description
ViewBuilder

A local view for this INamedCache

Implements

INamedCache
IObservableCache
IConcurrentCache
IQueryCache
IInvocableCache
ICache
IDictionary
ICollection
IEnumerable
IDisposable

Extension Methods

InvocableCacheEx.GetOrDefault(IInvocableCache, object, object)
InvocableCacheEx.InsertIfAbsent(IInvocableCache, object, object)
InvocableCacheEx.Remove(IInvocableCache, object, object)
InvocableCacheEx.Replace(IInvocableCache, object, object)
InvocableCacheEx.Replace(IInvocableCache, object, object, object)
In this article
Back to top Copyright © 2000, 2024, Oracle and/or its affiliates.