Class ChangeAwareCache<TObject, TKey>
- Namespace
- DynamicData 
- Assembly
- DynamicData.dll
A cache which captures all changes which are made to it. These changes are recorded until CaptureChanges() at which point thw changes are cleared. Used for creating custom operators.
public sealed class ChangeAwareCache<TObject, TKey> : ICache<TObject, TKey>, IQuery<TObject, TKey> where TObject : notnull where TKey : notnullType Parameters
- TObject
- The value of the cache. 
- TKey
- The key of the cache. 
- Inheritance
- 
      
      ChangeAwareCache<TObject, TKey>
Constructors
ChangeAwareCache()  
  Initializes a new instance of the ChangeAwareCache<TObject, TKey> class.
ChangeAwareCache(Dictionary<TKey, TObject>)
Initializes a new instance of the ChangeAwareCache<TObject, TKey> class.
Parameters
- dataDictionary<TKey, TObject>
- Data to populate the cache with. 
ChangeAwareCache(int)  
  Initializes a new instance of the ChangeAwareCache<TObject, TKey> class.
Parameters
- capacityint
- The capacity of the initial items. 
Properties
Count
Gets the count.
Property Value
Items
Gets the items.
Property Value
- IEnumerable<TObject>
KeyValues 
  Gets the items together with their keys.
Property Value
- IEnumerable<KeyValue <TKey, TObject>>Pair 
- The key values. 
Keys
Gets the keys.
Property Value
- IEnumerable<TKey>
Methods
Add(TObject, TKey) 
  Adds the item to the cache without checking whether there is an existing value in the cache.
Parameters
- itemTObject
- The item to add. 
- keyTKey
- The key to add. 
AddOrUpdate(TObject, TKey)  
  Adds or updates the item using the specified key.
Parameters
- itemTObject
- The item. 
- keyTKey
- The key. 
CaptureChanges() 
  Create a change set from recorded changes and clears known changes.
Returns
- ChangeSet <TObject, TKey>
- A change set with the key/value changes. 
Clear()
Clears all items.
Clone(IChangeSet<TObject, TKey>)
Clones the cache from the specified changes.
Parameters
- changesIChange- Set <TObject, TKey>
- The changes. 
Lookup(TKey)
Lookup a single item using the specified key.
Parameters
- keyTKey
- The key. 
Returns
- Optional<TObject>
- The looked up value. 
Remarks
Fast indexed lookup.
Refresh()
Raises an evaluate change for all items in the cache.
Refresh(IEnumerable<TKey>)
Raises an evaluate change for the specified keys.
Parameters
- keysIEnumerable<TKey>
- The keys to refresh. 
Refresh(TKey)
Raises an evaluate change for the specified key.
Parameters
- keyTKey
- The key. 
Remove(IEnumerable<TKey>)
Removes the item matching the specified keys.
Parameters
- keysIEnumerable<TKey>
- The keys. 
Remove(TKey)
Removes the item matching the specified key.
Parameters
- keyTKey
- The key.