M&B: Bannerlord 1.2.10
The horns sound, the ravens gather.
Loading...
Searching...
No Matches
TaleWorlds.Library.TimedDictionaryCache< TKey, TValue > Class Template Reference

Wraps the Dictionary<TKey, TValue> class to present a time-aware data structure that prunes stale entries. This class is lightweight when idle, no events will be run periodically. Pruning of expired cache items is only done on explicit or implicit request.

Public Member Functions

 TimedDictionaryCache (long validMilliseconds)
 
 TimedDictionaryCache (TimeSpan validTimeSpan)
 
void PruneExpiredItems ()
 There is normally no need to explicitly call this method, expired items are pruned implicitly when interacting with this class.
 
void Clear ()
 
bool ContainsKey (TKey key)
 
bool Remove (TKey key)
 
bool TryGetValue (TKey key, out TValue value)
 
MBReadOnlyDictionary< TKey, TValue > AsReadOnlyDictionary ()
 Beware: Relatively expensive operation. Do not use if not compulsory.
 

Properties

TValue this[TKey key] [get, set]
 

Constructor & Destructor Documentation

◆ TimedDictionaryCache() [1/2]

TaleWorlds.Library.TimedDictionaryCache< TKey, TValue >.TimedDictionaryCache ( long validMilliseconds)

◆ TimedDictionaryCache() [2/2]

TaleWorlds.Library.TimedDictionaryCache< TKey, TValue >.TimedDictionaryCache ( TimeSpan validTimeSpan)

Member Function Documentation

◆ PruneExpiredItems()

void TaleWorlds.Library.TimedDictionaryCache< TKey, TValue >.PruneExpiredItems ( )

◆ Clear()

void TaleWorlds.Library.TimedDictionaryCache< TKey, TValue >.Clear ( )

◆ ContainsKey()

bool TaleWorlds.Library.TimedDictionaryCache< TKey, TValue >.ContainsKey ( TKey key)

◆ Remove()

bool TaleWorlds.Library.TimedDictionaryCache< TKey, TValue >.Remove ( TKey key)

◆ TryGetValue()

bool TaleWorlds.Library.TimedDictionaryCache< TKey, TValue >.TryGetValue ( TKey key,
out TValue value )

◆ AsReadOnlyDictionary()

MBReadOnlyDictionary< TKey, TValue > TaleWorlds.Library.TimedDictionaryCache< TKey, TValue >.AsReadOnlyDictionary ( )

Property Documentation

◆ this[TKey key]

TValue TaleWorlds.Library.TimedDictionaryCache< TKey, TValue >.this[TKey key]
getset