Class MessageTracker
Maintains a timed cache of message IDs.
Inherited Members
Namespace: PeerTalk
Assembly: PeerTalk.dll
Syntax
public class MessageTracker
Remarks
RecentlySeen(String, Nullable<DateTime>) can be used to detect duplicate messages based on its ID.
Properties
| Improve this Doc View SourceRecent
The definition of recent.
Declaration
public TimeSpan Recent { get; set; }
Property Value
Type | Description |
---|---|
TimeSpan | Defaults to 10 minutes. |
Remarks
Messages that have been in the cache longer that this value will be removed and then be considered as "not seen".
Methods
| Improve this Doc View SourcePrune(DateTime)
Removes any message that is past its expiry date.
Declaration
public void Prune(DateTime now)
Parameters
Type | Name | Description |
---|---|---|
DateTime | now | The current clock time. |
RecentlySeen(String, Nullable<DateTime>)
Determines if the message has recently been seen.
Declaration
public bool RecentlySeen(string id, DateTime? now = default(DateTime? ))
Parameters
Type | Name | Description |
---|---|---|
String | id | The unique identifier of a message. |
Nullable<DateTime> | now |
Returns
Type | Description |
---|---|
Boolean | true if the |