Show / Hide Table of Contents

Interface IObservableCache

The IObservableCache interface represents an object with a model being an ICache that allows for pluggable notifications for occuring changes.

Inherited Members
ICache.GetAll(ICollection)
ICache.Insert(object, object)
ICache.Insert(object, object, long)
ICache.InsertAll(IDictionary)
ICache.Entries
ICache.GetEnumerator()
IDictionary.Add(object, object)
IDictionary.Clear()
IDictionary.Contains(object)
IDictionary.Remove(object)
IDictionary.IsFixedSize
IDictionary.IsReadOnly
IDictionary.this[object]
IDictionary.Keys
IDictionary.Values
ICollection.CopyTo(Array, int)
ICollection.Count
ICollection.IsSynchronized
ICollection.SyncRoot
Namespace: Tangosol.Net.Cache
Assembly: Coherence.dll
Syntax
public interface IObservableCache : ICache, IDictionary, ICollection, IEnumerable
Remarks

This is primarily intended for caches that have automatic pruning and purging strategies or caches that are asynchronously modified by different threads.

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
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
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
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.

RemoveCacheListener(ICacheListener)

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

Declaration
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
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
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.

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