Class ExpressionInterningCache
A concurrent cache for LINQ expression trees.
Inheritance
System.Object
ExpressionInterningCache
Implements
Namespace: System.Linq.Expressions
Assembly: Nuqleon.Linq.CompilerServices.dll
Syntax
public class ExpressionInterningCache : Object, IExpressionInterningCache
Constructors
ExpressionInterningCache()
Instantiates a concurrent cache for LINQ expression trees using the default expression equality comparison strategy.
Declaration
public ExpressionInterningCache()
ExpressionInterningCache(Func<ExpressionEqualityComparator>)
Instantiates a concurrent cache for LINQ expression trees using the given expression equality comparison strategy.
Declaration
public ExpressionInterningCache(Func<ExpressionEqualityComparator> comparatorFactory)
Parameters
Type | Name | Description |
---|---|---|
System.Func<ExpressionEqualityComparator> | comparatorFactory | A factory to generate expression equality comparers. |
Properties
Count
Gets the number of entries in the cache.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Clear()
Clears the cache.
Declaration
public void Clear()
GetOrAdd(Expression)
Rewrites the given expression tree with nodes from the cache.
Declaration
public Expression GetOrAdd(Expression expression)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression | expression | The expression to rewrite. |
Returns
Type | Description |
---|---|
System.Linq.Expressions.Expression | An equivalent expression with pre-cached nodes replacing nodes in the given tree. |
Remarks
As a side-effect, adds each new node to the cache.