Show / Hide Table of Contents

Interface IInvocableCacheEntry

An IInvocableCacheEntry contains additional information and exposes additional operations that the basic ICacheEntry does not.

Namespace: Tangosol.Net.Cache
Assembly: Coherence.dll
Syntax
public interface IInvocableCacheEntry : ICacheEntry
Remarks

It allows non-existent entries to be represented, thus allowing their optional creation. It allows existent entries to be removed from the cache. It supports a number of optimizations that can ultimately be mapped through to indexes and other data structures of the underlying dictionary.

Properties

IsPresent

Determine if this entry exists in the cache.

Declaration
bool IsPresent { get; }
Property Value
Type Description
bool

true if this entry exists in the containing cache.

Remarks

If the entry is not present, it can be created by setting the Value property. If the entry is present, it can be destroyed by calling Remove(bool).

Key

Gets the key corresponding to this entry.

Declaration
object Key { get; }
Property Value
Type Description
object

The key corresponding to this entry; may be null if the underlying cache supports null keys.

Remarks

The resultant key does not necessarily exist within the containing cache, which is to say that IInvocableCache.Contains(Key) could return false. To test for the presence of this key within the dictionary, use IsPresent, and to create the entry for the key, set Value property.

Value

Gets or sets the value corresponding to this entry.

Declaration
object Value { get; set; }
Property Value
Type Description
object

The value corresponding to this entry; may be null if the value is null or if the entry does not exist in the cache.

Remarks

If the entry does not exist, then the value will be null.

To differentiate between a null value and a non-existent entry, use IsPresent.

Methods

Extract(IValueExtractor)

Extract a value out of the entry's value.

Declaration
object Extract(IValueExtractor extractor)
Parameters
Type Name Description
IValueExtractor extractor

An IValueExtractor to apply to the entry's value

Returns
Type Description
object

The extracted value.

Remarks

Calling this method is semantically equivalent to extractor.Extract(entry.Value), but this method may be significantly less expensive because the resultant value may be obtained from a forward index, for example.

Remove(bool)

Remove this entry from the cache if it is present in the cache.

Declaration
void Remove(bool isSynthetic)
Parameters
Type Name Description
bool isSynthetic

Pass true only if the removal from the dictionary should be treated as a synthetic event.

Remarks

This method supports both the operation corresponding to IDictionary.Remove as well as synthetic operations such as eviction. If the containing cache does not differentiate between the two, then this method will always be identical to IInvocableCache.Remove(Key).

SetValue(object, bool)

Store the value corresponding to this entry.

Declaration
void SetValue(object value, bool isSynthetic)
Parameters
Type Name Description
object value

The new value for this entry.

bool isSynthetic

Pass true only if the insertion into or modification of the cache should be treated as a synthetic event.

Remarks

If the entry does not exist, then the entry will be created by invoking this method, even with a null value (assuming the cache supports null values).

Unlike the property Value, this method does not return the previous value, and as a result may be significantly less expensive (in terms of cost of execution) for certain cache implementations.

Update(IValueUpdater, object)

Update the entry's value.

Declaration
void Update(IValueUpdater updater, object value)
Parameters
Type Name Description
IValueUpdater updater

An IValueUpdater used to modify the entry's value.

object value

Value to update target object to.

Remarks

Calling this method is semantically equivalent to:

object target = entry.Value;
updater.Update(target, value);
entry.Value = target;

The benefit of using this method is that it may allow the entry implementation to significantly optimize the operation, such as for purposes of delta updates and backup maintenance.

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