@@ -44,7 +44,7 @@ public sealed class MemoryVault<TU> : IDisposable
4444 /// <summary>
4545 /// Thread-safe dictionary for storing items.
4646 /// </summary>
47- private readonly ConcurrentDictionary < long , VaultItem < TU > > _vault ;
47+ private readonly ConcurrentDictionary < long , VaultItem < TU ? > > _vault ;
4848
4949 /// <summary>
5050 /// Timer for periodic cleanup of expired items.
@@ -137,7 +137,7 @@ public static MemoryVault<TU> Instance
137137 /// </summary>
138138 private MemoryVault ( )
139139 {
140- _vault = new ConcurrentDictionary < long , VaultItem < TU > > ( ) ;
140+ _vault = new ConcurrentDictionary < long , VaultItem < TU ? > > ( ) ;
141141 _nextId = 0 ;
142142
143143 // Initialize cleanup timer with configurable interval
@@ -151,14 +151,14 @@ private MemoryVault()
151151 /// <param name="expiryTime">The expiry time.</param>
152152 /// <param name="description">The description.</param>
153153 /// <returns>Address of memory</returns>
154- public long Add ( TU data , TimeSpan ? expiryTime = null , string description = "" )
154+ public long Add ( TU ? data , TimeSpan ? expiryTime = null , string ? description = "" )
155155 {
156156 EnsureNotDisposed ( ) ;
157157
158158 // Generate next available unique ID atomically
159159 var identifier = Interlocked . Increment ( ref _nextId ) ;
160160
161- var vaultItem = new VaultItem < TU > ( data , expiryTime , description ) ;
161+ var vaultItem = new VaultItem < TU ? > ( data , expiryTime , description ) ;
162162
163163 _vault [ identifier ] = vaultItem ;
164164
@@ -226,11 +226,11 @@ public void Clear()
226226 /// Returns all non-expired items in the vault.
227227 /// </summary>
228228 /// <returns>List with stored data.</returns>
229- public List < TU > GetAll ( )
229+ public List < TU ? > GetAll ( )
230230 {
231231 EnsureNotDisposed ( ) ;
232232
233- var results = new List < TU > ( ) ;
233+ var results = new List < TU ? > ( ) ;
234234 var expiredKeys = new List < long > ( ) ;
235235
236236 foreach ( var kvp in _vault )
@@ -350,7 +350,7 @@ public long LoadFromDisk(string filePath)
350350 if ( item != null )
351351 {
352352 // Add item to vault and preserve metadata via init-only constructor
353- var vaultItem = new VaultItem < TU > ( item . Data , item . ExpiryTime , item . Description )
353+ var vaultItem = new VaultItem < TU ? > ( item . Data , item . ExpiryTime , item . Description )
354354 {
355355 AdditionalMetadata = item . AdditionalMetadata
356356 } ;
0 commit comments