Show / Hide Table of Contents

Class ConverterCollections.ConverterCache

A Converter Cache views an underlying ICache through a set of key and value IConverters.

Inheritance
object
ConverterCollections.ConverterDictionary
ConverterCollections.ConverterCache
ConverterCollections.ConverterConcurrentCache
ConverterCollections.ConverterInvocableCache
ConverterCollections.ConverterNamedCache
ConverterCollections.ConverterObservableCache
ConverterCollections.ConverterQueryCache
Implements
ICache
IDictionary
ICollection
IEnumerable
Inherited Members
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.ConverterCache : ConverterCollections.ConverterDictionary, ICache, IDictionary, ICollection, IEnumerable

Constructors

ConverterCache(ICache, IConverter, IConverter, IConverter, IConverter)

Constructor.

Declaration
public ConverterCache(ICache cache, IConverter convKeyUp, IConverter convKeyDown, IConverter convValUp, IConverter convValDown)
Parameters
Type Name Description
ICache cache

The underlying ICache.

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_entries

The entry collection.

Declaration
[NonSerialized]
protected ICollection m_entries
Field Value
Type Description
ICollection

Properties

Cache

The underlying ICache.

Declaration
public virtual ICache Cache { get; }
Property Value
Type Description
ICache

The underlying ICache.

Entries

Gets a collection of ICacheEntry instances within the cache.

Declaration
public virtual ICollection Entries { get; }
Property Value
Type Description
ICollection

Methods

GetAll(ICollection)

Get the values for all the specified keys, if they are in the cache.

Declaration
public virtual IDictionary GetAll(ICollection keys)
Parameters
Type Name Description
ICollection keys

A collection of keys that may be in the named cache.

Returns
Type Description
IDictionary

A dictionary of keys to values for the specified keys passed in keys.

Remarks

For each key that is in the cache, that key and its corresponding value will be placed in the dictionary that is returned by this method. The absence of a key in the returned dictionary indicates that it was not in the cache, which may imply (for caches that can load behind the scenes) that the requested data could not be loaded.

The result of this method is defined to be semantically the same as the following implementation, without regards to threading issues:

IDictionary dict = new AnyDictionary();
// could be a Hashtable (but does not have to)
foreach (object key in colKeys)
{
    object value = this[key];
    if (value != null || Contains(key))
    {
        dict[key] = value;
    }
}
return dict;

GetEnumerator()

Returns an IDictionaryEnumerator object for the dictionary.

Declaration
public override IDictionaryEnumerator GetEnumerator()
Returns
Type Description
IDictionaryEnumerator

An IDictionaryEnumerator for the dictionary.

Overrides
ConverterCollections.ConverterDictionary.GetEnumerator()

Insert(object, object)

Associates the specified value with the specified key in this cache.

Declaration
public virtual object Insert(object key, object value)
Parameters
Type Name Description
object key

Key with which the specified value is to be associated.

object value

Value to be associated with the specified key.

Returns
Type Description
object

Previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the dictionary previously associated null with the specified key, if the implementation supports null values.

Remarks

If the cache previously contained a mapping for this key, the old value is replaced.

Invoking this method is equivalent to the following call:

Insert(key, value, CacheExpiration.Default);

Insert(object, object, long)

Associates the specified value with the specified key in this cache.

Declaration
public virtual object Insert(object key, object value, long millis)
Parameters
Type Name Description
object key

Key with which the specified value is to be associated.

object value

Value to be associated with the specified key.

long millis

The number of milliseconds until the cache entry will expire, also referred to as the entry's "time to live"; pass DEFAULT to use the cache's default time-to-live setting; pass NEVER to indicate that the cache entry should never expire; this milliseconds value is not a date/time value, but the amount of time object will be kept in the cache.

Returns
Type Description
object

Previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the cache previously associated null with the specified key, if the implementation supports null values.

Remarks

If the cache previously contained a mapping for this key, the old value is replaced.

This variation of the Insert(object, object) method allows the caller to specify an expiry (or "time to live") for the cache entry.
Exceptions
Type Condition
NotSupportedException

If the requested expiry is a positive value and the implementation does not support expiry of cache entries.

InsertAll(IDictionary)

Copies all of the mappings from the specified dictionary to this cache (optional operation).

Declaration
public virtual void InsertAll(IDictionary dictionary)
Parameters
Type Name Description
IDictionary dictionary

Mappings to be stored in this cache.

Remarks

These mappings will replace any mappings that this cache had for any of the keys currently in the specified dictionary.

Exceptions
Type Condition
InvalidCastException

If the class of a key or value in the specified dictionary prevents it from being stored in this cache.

InvalidOperationException

If the lock could not be succesfully obtained for some key.

NullReferenceException

This cache does not permit null keys or values, and the specified key or value is null.

InstantiateCacheEnumerator(ICacheEnumerator, IConverter, IConverter, IConverter)

Returns an instance of ICacheEnumerator that uses IConverters to view an underlying enumerator.

Declaration
protected virtual ICacheEnumerator InstantiateCacheEnumerator(ICacheEnumerator enumerator, IConverter convKeyUp, IConverter convValUp, IConverter convValDown)
Parameters
Type Name Description
ICacheEnumerator enumerator

The underlying ICacheEnumerator.

IConverter convKeyUp

The IConverter to view the underlying ICacheEnumerator keys through.

IConverter convValUp

The IConverter to view the underlying ICacheEnumerator values through.

IConverter convValDown

The IConverter to change the underlying ICacheEnumerator values through.

Returns
Type Description
ICacheEnumerator

An ICacheEnumerator that views the passed enumerator through the specified IConverters.

InstantiateEntries(ICollection, IConverter, IConverter, IConverter, IConverter)

Create a Converter Entry collection.

Declaration
protected virtual ConverterCollections.ConverterCacheEntries InstantiateEntries(ICollection col, IConverter convKeyUp, IConverter convKeyDown, IConverter convValUp, IConverter convValDown)
Parameters
Type Name Description
ICollection col

The underlying collection of entries.

IConverter convKeyUp

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

IConverter convKeyDown

The IConverter to use to pass keys down to the underlying cache's entry collection.

IConverter convValUp

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

IConverter convValDown

The IConverter to use to pass values down to the underlying cache's entry collection.

Returns
Type Description
ConverterCollections.ConverterCacheEntries

A Converter Entry collection.

Implements

ICache
IDictionary
ICollection
IEnumerable
In this article
Back to top Copyright © 2000, 2024, Oracle and/or its affiliates.