-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathCacheItemEventArgs.cs
More file actions
69 lines (59 loc) · 1.73 KB
/
CacheItemEventArgs.cs
File metadata and controls
69 lines (59 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
namespace Waher.Runtime.Cache
{
/// <summary>
/// Reason for removing the item.
/// </summary>
public enum RemovedReason
{
/// <summary>
/// Item was replaced by a newer value.
/// </summary>
Replaced,
/// <summary>
/// Item has not been used.
/// </summary>
NotUsed,
/// <summary>
/// Item is too old, or has expired.
/// </summary>
Old,
/// <summary>
/// Cache is full and space had to be made for new items.
/// </summary>
Space,
/// <summary>
/// Item was manually removed by the controlling application.
/// </summary>
Manual
}
/// <summary>
/// Event arguments for cache item removal events.
/// </summary>
/// <typeparam name="KeyType">Cache key type.</typeparam>
/// <typeparam name="ValueType">Cache value type.</typeparam>
public class CacheItemEventArgs<KeyType, ValueType> : EventArgs
{
private readonly KeyType key;
private readonly ValueType value;
private readonly RemovedReason reason;
internal CacheItemEventArgs(KeyType Key, ValueType Value, RemovedReason Reason)
{
this.key = Key;
this.value = Value;
this.reason = Reason;
}
/// <summary>
/// Key of item that was removed.
/// </summary>
public KeyType Key => this.key;
/// <summary>
/// Value of item that was removed.
/// </summary>
public ValueType Value => this.value;
/// <summary>
/// Reason for removing the item.
/// </summary>
public RemovedReason Reason => this.reason;
}
}