Class LeastRecentlyUsedCompiledDelegateCache
Compiled delegate cache with a least recently used (LRU) eviction policy.
Inheritance
Implements
Namespace: System.Linq.Expressions
Assembly: Nuqleon.Linq.CompilerServices.dll
Syntax
public class LeastRecentlyUsedCompiledDelegateCache : Object, ICompiledDelegateCache
  Constructors
LeastRecentlyUsedCompiledDelegateCache(Int32)
Creates a new compiled delegate cache with a least recently used (LRU) eviction policy.
Declaration
public LeastRecentlyUsedCompiledDelegateCache(int capacity)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | capacity | Maximum capacity of the cache.  | 
      
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(LambdaExpression)
Gets a compiled delegate from the cache if the specified lambda expression already has been compiled. Otherwise, compiles the lambda expression to a delegate and stores the result.
Declaration
public Delegate GetOrAdd(LambdaExpression expression)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Linq.Expressions.LambdaExpression | expression | Lambda expression to look up in the cache.  | 
      
Returns
| Type | Description | 
|---|---|
| System.Delegate | Compiled delegate to execute the lambda expression.  | 
      
OnAdded(LambdaExpression, Delegate)
Raises the Added event with the specified arguments.
Declaration
protected virtual void OnAdded(LambdaExpression expression, Delegate delegate)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Linq.Expressions.LambdaExpression | expression | Expression found in the cache.  | 
      
| System.Delegate | delegate | Compiled delegate of the expression.  | 
      
OnEvicted(LambdaExpression, Delegate)
Raises the Evicted event with the specified arguments.
Declaration
protected virtual void OnEvicted(LambdaExpression expression, Delegate delegate)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Linq.Expressions.LambdaExpression | expression | Expression found in the cache.  | 
      
| System.Delegate | delegate | Compiled delegate of the expression.  | 
      
OnHit(LambdaExpression, Delegate)
Raises the Hit event with the specified arguments.
Declaration
protected virtual void OnHit(LambdaExpression expression, Delegate delegate)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Linq.Expressions.LambdaExpression | expression | Expression found in the cache.  | 
      
| System.Delegate | delegate | Compiled delegate of the expression.  | 
      
Events
Added
Event raised when a cache addition occurs.
Declaration
public event EventHandler<CacheEventArgs> Added
  Event Type
| Type | Description | 
|---|---|
| System.EventHandler<CacheEventArgs> | 
Evicted
Event raised when a cache eviction occurs.
Declaration
public event EventHandler<CacheEventArgs> Evicted
  Event Type
| Type | Description | 
|---|---|
| System.EventHandler<CacheEventArgs> | 
Hit
Event raised when a cache hit occurs.
Declaration
public event EventHandler<CacheEventArgs> Hit
  Event Type
| Type | Description | 
|---|---|
| System.EventHandler<CacheEventArgs> |