Class InterningCache<T>
A cache that interns values: it maps each input value to a value that is structurally equal to the input and all structurally equal input values are mapped to the same output value as long as that output value is live.
Inherited Members
Namespace: Flame.Collections
Assembly: Flame.dll
Syntax
public sealed class InterningCache<T> where T : class
Type Parameters
| Name | Description |
|---|---|
| T |
Constructors
| Edit this page View SourceInterningCache(IEqualityComparer<T>)
Creates an interning cache from a comparer.
Declaration
public InterningCache(IEqualityComparer<T> comparer)
Parameters
| Type | Name | Description |
|---|---|---|
| IEqualityComparer<T> | comparer | A comparer that tests if input values are structurally equal. |
InterningCache(IEqualityComparer<T>, Func<T, T>)
Creates an interning cache from a comparer and an initialization function.
Declaration
public InterningCache(IEqualityComparer<T> comparer, Func<T, T> initialize)
Parameters
| Type | Name | Description |
|---|---|---|
| IEqualityComparer<T> | comparer | A comparer that tests if input values are structurally equal. |
| Func<T, T> | initialize | A function that initializes output values. |
Methods
| Edit this page View SourceIntern(T)
Interns a particular value.
Declaration
public T Intern(T value)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | An input value. |
Returns
| Type | Description |
|---|---|
| T | A value that is structurally equal to the input value. |