Class SynchronizedStreamDebouncer<TInstance, TKey>
A class that encapsulates synchronized read-write operations to timestamped records, and filters frequent occurrences of a similar event.
Inheritance
Namespace: Telerik.CallHome.Debouncing
Assembly: Telerik.Windows.Controls.dll
Syntax
public abstract class SynchronizedStreamDebouncer<TInstance, TKey> : Object, IDebouncer<TInstance>, IClearableDebouncer
Type Parameters
TInstance
|
TKey
|
Constructors
SynchronizedStreamDebouncer()
Declaration
protected SynchronizedStreamDebouncer()
Properties
Name
Gets the stream name.
Declaration
protected abstract string Name { get; }
Property Value
System.
|
Now
Gets the current time.
Declaration
protected virtual DateTime Now { get; }
Property Value
System.
|
Timeout
Gets the debounce timeout for similar events.
Declaration
protected virtual TimeSpan Timeout { get; }
Property Value
System.
|
Methods
AcquireStream()
Tries to open the storage stream and lock exclusively for read/write. May throws if the stream is currently acquired elsewhere.
When using file or isolated storage stream, lock the file and use the Acquire
Declaration
protected abstract Stream AcquireStream()
Returns
System.
|
AcquireSynchronizationLock()
Blocks the execution of the current thread until the synchronization lock can be acquired.
Returns a System.
Declaration
protected abstract IDisposable AcquireSynchronizationLock()
Returns
System.
|
Clear()
Clears all entries from the timetable.
Declaration
public void Clear()
Deserialize(Stream)
Deserialize the provided stream to lookup table.
Declaration
protected abstract IDictionary<TKey, DateTime> Deserialize(Stream stream)
Parameters
System.
|
Returns
System.
|
Key(TInstance)
Selects only the relevant key information from the instance.
Declaration
protected abstract TKey Key(TInstance instance)
Parameters
TInstance
instance
|
Returns
TKey
|
Open()
Opens the stream, reads time records, allows debounce checks to be performed, and upon disposal - writes back any new records to the stream.
Declaration
public IDebounceScope<TInstance> Open()
Returns
IDebounce
|
Serialize(Stream, IEnumerable<KeyValuePair<TKey, DateTime>>)
Serialize the lookup table to stream.
Declaration
protected abstract void Serialize(Stream stream, IEnumerable<KeyValuePair<TKey, DateTime>> table)
Parameters
System.
|
System.
|