Class AbstractKeySetBasedCache
AbstractKeySetBasedCache is an extension to the AbstractKeyBasedCache that has a full awareness of the set of keys upon which the cache is based.
Inherited Members
Namespace: Tangosol.Net.Cache.Support
Assembly: Coherence.dll
Syntax
public abstract class AbstractKeySetBasedCache : AbstractKeyBasedCache, ICache, IDictionary, ICollection, IEnumerable
Remarks
As a result, it is possible to optimize the implementation of a number of methods that benefit from a knowledge of the entire set of keys.
Read-only implementations must implement GetInternalKeysCollection() and Get(object). Read/write implementations must additionally implement Insert(object, object, long) and Remove(object). If the implementation has any cost of returning an "old value", then the InsertAll(IDictionary) and RemoveBlind(object) methods should also be implemented. The only other obvious method for optimization is Clear(), if the implementation is able to do it in bulk.
Properties
Count
Returns the number of key-value mappings in this cache.
Declaration
public override int Count { get; }
Property Value
Type | Description |
---|---|
int | The number of key-value mappings in this cache. |
Overrides
Methods
Contains(object)
Returns true if this cache contains a mapping for the specified key.
Declaration
public override bool Contains(object key)
Parameters
Type | Name | Description |
---|---|---|
object | key | Key whose mapping is searched for. |
Returns
Type | Description |
---|---|
bool | true if this cache contains a mapping for the specified key, false otherwise. |
Overrides
GetInternalKeysCollection()
Obtain a collection of keys that are represented by this cache.
Declaration
protected abstract ICollection GetInternalKeysCollection()
Returns
Type | Description |
---|---|
ICollection | An internal collection of keys that are contained by this cache. |
Remarks
The AbstractKeySetBasedCache only utilizes the internal keys collection as a read-only resource.
GetKeysEnumerator()
Create an IEnumerator over the keys in this cache.
Declaration
protected override IEnumerator GetKeysEnumerator()
Returns
Type | Description |
---|---|
IEnumerator | A new instance of an enumerator over the keys in this cache. |
Overrides
Remarks
Note that this implementation delegates back to the keys collection, while the super type delegates from the keys collection to this method.
InstantiateKeyEnumerator()
Factory pattern: Create an IEnumerator over the keys in the cache.
Declaration
protected virtual IEnumerator InstantiateKeyEnumerator()
Returns
Type | Description |
---|---|
IEnumerator | A new instance of IEnumerator that iterates over the keys in the cache. |