Class FrequentReadSynchronizedHash<TKey, TValue>
Synchronized Hash for inserts/removes. Unsynchronized for reads. Optimized for frequent reads relative to writes.
Inheritance
System.Object
FrequentReadSynchronizedHash<TKey, TValue>
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public abstract class FrequentReadSynchronizedHash<TKey, TValue> : object
Type Parameters
Name | Description |
---|---|
TKey | |
TValue |
Constructors
FrequentReadSynchronizedHash()
Creates an instance of a FrequentReadSynchronizedList<T>.
Declaration
protected FrequentReadSynchronizedHash()
FrequentReadSynchronizedHash(Object)
Creates an instance of a FrequentReadSynchronizedList<T>.
Synchronization object.Declaration
protected FrequentReadSynchronizedHash(object lockObject)
Parameters
Type | Name | Description |
---|---|---|
System.Object | lockObject |
Properties
Count
Gets the count of items in this hash.
Declaration
public long Count { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
Values
Gets the values in the collection not subject to synchronization and Concurrent Modification/Access issues. May be missing newly added or removed values.
Declaration
public TValue[] Values { get; }
Property Value
Type | Description |
---|---|
TValue[] |
Methods
Clear()
Clears the synchronized hash.
Declaration
public void Clear()
ContainsKey(TKey)
Return a value indicating whether ther Hash contains a value for a given key.
Declaration
public bool ContainsKey(TKey key)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key |
Returns
Type | Description |
---|---|
System.Boolean |
GetArray(Int32)
Gets an array of a given type of a given length.
Declaration
protected abstract TValue[] GetArray(int count)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | count |
Returns
Type | Description |
---|---|
TValue[] |
Insert(TKey, TValue)
Synchronized insert into collection.
Declaration
public void Insert(TKey key, TValue value)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | Key |
TValue | value | Value |
Remove(TKey)
Synchronized remove into collection.
Declaration
public void Remove(TKey key)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | Key |
TryGetValue(TKey, out TValue)
Tries to get a value for a given key.
Declaration
public bool TryGetValue(TKey key, out TValue value)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key |
TValue | value | The value |
Returns
Type | Description |
---|---|
System.Boolean |