Class ConditionalIndex
ConditionalIndex is an ICacheIndex implementation that uses an associated filter to evaluate whether or not an entry should be indexed. An entry's extracted value is only added to the index if the filter evaluates to true.
Implements
Inherited Members
Namespace: Tangosol.Net.Cache
Assembly: Coherence.dll
Syntax
public class ConditionalIndex : SimpleCacheIndex, ICacheIndex
Constructors
ConditionalIndex(IFilter, IValueExtractor, bool, IComparer, bool)
Construct a ConditionalIndex.
Declaration
public ConditionalIndex(IFilter filter, IValueExtractor extractor, bool ordered, IComparer comparer, bool forwardIndex)
Parameters
Type | Name | Description |
---|---|---|
IFilter | filter | the filter that is used to evaluate the entries of the resource cache that is being indexed. |
IValueExtractor | extractor | the IValueExtractor that is used to extract an indexed value from a resource cache entry. |
bool | ordered |
|
IComparer | comparer | the IComparer object which imposes an ordering on entries in the index; or null if the entries' values natural ordering should be used. |
bool | forwardIndex | specifies whether or not this index supports a forward map |
Properties
Filter
Get the associated filter.
Declaration
public virtual IFilter Filter { get; }
Property Value
Type | Description |
---|---|
IFilter | The filter. |
IsForwardIndexSupported
Determine whether or not this ConditionalIndex supports a forward index.
Declaration
public bool IsForwardIndexSupported { get; }
Property Value
Type | Description |
---|---|
bool |
|
IsPartial
Determine if indexed information for any entry in the indexed ICache has been excluded from this index. This information is used by IIndexAwareFilter implementations to determine the most optimal way to apply the index.
Declaration
public override bool IsPartial { get; }
Property Value
Type | Description |
---|---|
bool | true if any entry of the indexed ICache has been excluded from the index, false otherwise |
Overrides
Methods
DeleteInternal(ICacheEntry)
Update this index in response to a delete operation on a cache.
Declaration
protected override void DeleteInternal(ICacheEntry entry)
Parameters
Type | Name | Description |
---|---|---|
ICacheEntry | entry | The entry representing the object being inserted. |
Overrides
Equals(SimpleCacheIndex)
Compares this index with another index for equality.
Declaration
public override bool Equals(SimpleCacheIndex index)
Parameters
Type | Name | Description |
---|---|---|
SimpleCacheIndex | index | index to compare this index with. |
Returns
Type | Description |
---|---|
bool |
|
Overrides
Remarks
This method returns true if this index and the specified index have exactly the same contents.
EvaluateEntry(ICacheEntry)
Evaluate the given entry using this index's filter. If the entry does not pass the filter then it should be excluded from this index, making this a partial index.
Declaration
protected virtual bool EvaluateEntry(ICacheEntry entry)
Parameters
Type | Name | Description |
---|---|---|
ICacheEntry | entry | The entry to evaluate. |
Returns
Type | Description |
---|---|
bool |
|
Get(object)
Using the index information if possible, get the value associated with the specified key. This is expected to be more efficient than using the IValueExtractor against an object containing the value, because the index should already have the necessary information at hand.
Declaration
public override object Get(object key)
Parameters
Type | Name | Description |
---|---|---|
object | key | The key that specifies the object to extract the value from. |
Returns
Type | Description |
---|---|
object | The value that would be extracted by this ICacheIndex's IValueExtractor from the object specified by the passed key; NO_VALUE if the index does not have the necessary information. |
Overrides
GetForwardValue(object)
Get the forward index value associated with the specified key.
Declaration
protected override object GetForwardValue(object key)
Parameters
Type | Name | Description |
---|---|---|
object | key | The key. |
Returns
Type | Description |
---|---|
object | The value associated with the key. |
Overrides
InsertInternal(ICacheEntry)
Update this index in response to a insert operation on a cache.
Declaration
protected override void InsertInternal(ICacheEntry entry)
Parameters
Type | Name | Description |
---|---|---|
ICacheEntry | entry | The entry representing the object being inserted. |
Overrides
InstantiateForwardIndex()
Instantiate the forward index.
Declaration
protected override IDictionary InstantiateForwardIndex()
Returns
Type | Description |
---|---|
IDictionary | The forward index. |
Overrides
RemoveForwardEntry(object)
Remove the forward index entry for the specified key.
Declaration
protected override void RemoveForwardEntry(object key)
Parameters
Type | Name | Description |
---|---|---|
object | key | The key to remove the forward index entry for. |
Overrides
ToString()
Returns string representation of this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | String representation of this instance. |
Overrides
UpdateInternal(ICacheEntry)
Update this index in response to a update operation on a cache.
Declaration
protected override void UpdateInternal(ICacheEntry entry)
Parameters
Type | Name | Description |
---|---|---|
ICacheEntry | entry | The entry representing the object being updated. |