1
- using System . Collections . Concurrent ;
1
+ using System ;
2
+ using System . Collections . Concurrent ;
3
+ using System . ComponentModel ;
2
4
using System . Runtime . Serialization ;
3
5
using SharpHoundCommonLib . Enums ;
4
6
@@ -18,6 +20,8 @@ public class Cache
18
20
//
19
21
// [DataMember]private ConcurrentDictionary<string, string> _valueToIDCache;
20
22
23
+ private static Version defaultVersion = new ( 1 , 0 , 0 ) ;
24
+
21
25
private Cache ( )
22
26
{
23
27
ValueToIdCache = new ConcurrentDictionary < string , string > ( ) ;
@@ -36,6 +40,8 @@ private Cache()
36
40
[ DataMember ] public ConcurrentDictionary < string , string > SIDToDomainCache { get ; private set ; }
37
41
38
42
[ DataMember ] public ConcurrentDictionary < string , string > ValueToIdCache { get ; private set ; }
43
+ [ DataMember ] public DateTime CacheCreationDate { get ; set ; }
44
+ [ DataMember ] public Version CacheCreationVersion { get ; set ; }
39
45
40
46
[ IgnoreDataMember ] private static Cache CacheInstance { get ; set ; }
41
47
@@ -137,9 +143,17 @@ private static string GetPrefixKey(string key, string domain)
137
143
/// Creates a new empty cache instance
138
144
/// </summary>
139
145
/// <returns></returns>
140
- public static Cache CreateNewCache ( )
146
+ public static Cache CreateNewCache ( Version version = null )
141
147
{
142
- return new Cache ( ) ;
148
+ if ( version == null )
149
+ {
150
+ version = defaultVersion ;
151
+ }
152
+ return new Cache
153
+ {
154
+ CacheCreationVersion = version ,
155
+ CacheCreationDate = DateTime . Now . Date
156
+ } ;
143
157
}
144
158
145
159
/// <summary>
0 commit comments