Class RecentMessages
Maintains a sequence of recent messages.
Inherited Members
Namespace: Makaretu.Dns
Assembly: Makaretu.Dns.Multicast.dll
Syntax
public class RecentMessages
Remarks
RecentMessages is used to determine if a message has already been processed within the specified Interval.
Fields
| Improve this Doc View SourceMessages
Recent messages.
Declaration
public ConcurrentDictionary<string, DateTime> Messages
Field Value
Type | Description |
---|---|
ConcurrentDictionary<String, DateTime> | The key is the Base64 encoding of the MD5 hash of a message and the value is when the message was seen. |
Properties
| Improve this Doc View SourceInterval
The time interval used to determine if a message is recent.
Declaration
public TimeSpan Interval { get; set; }
Property Value
Type | Description |
---|---|
TimeSpan |
Methods
| Improve this Doc View SourceGetId(Byte[])
Gets a unique ID for a message.
Declaration
public string GetId(byte[] message)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | message | The binary representation of a message. |
Returns
Type | Description |
---|---|
String | The Base64 encoding of the MD5 hash of the |
Prune()
Remove any messages that are stale.
Declaration
public int Prune()
Returns
Type | Description |
---|---|
Int32 | The number messages that were pruned. |
Remarks
Anything older than an Interval ago is removed.
TryAdd(Byte[])
Try adding a message to the recent message list.
Declaration
public bool TryAdd(byte[] message)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | message | The binary representation of a message. |
Returns
Type | Description |
---|---|
Boolean | true if the message, did not already exist; otherwise, false the message exists within the Interval. |