Table of Contents

Interface ICompilerCache

Namespace
Ecng.Compilation
Assembly
Ecng.Compilation.dll

Defines methods for caching compiled assemblies.

public interface ICompilerCache
Extension Methods

Properties

Count

Gets the number of cached assemblies.

int Count { get; }

Property Value

int

Methods

Add(string, IEnumerable<string>, IEnumerable<string>, byte[])

Adds a compiled assembly to the cache.

void Add(string ext, IEnumerable<string> sources, IEnumerable<string> refs, byte[] assembly)

Parameters

ext string

The file extension used in key generation.

sources IEnumerable<string>

The source code files.

refs IEnumerable<string>

The referenced assemblies.

assembly byte[]

The compiled assembly bytes to cache.

Clear()

Clears all cached assemblies.

void Clear()

Init()

Initializes the cache.

void Init()

Remove(string, IEnumerable<string>, IEnumerable<string>)

Removes a cached assembly based on extension, sources, and references.

bool Remove(string ext, IEnumerable<string> sources, IEnumerable<string> refs)

Parameters

ext string

The file extension used in key generation.

sources IEnumerable<string>

The source code files.

refs IEnumerable<string>

The referenced assemblies.

Returns

bool

true if the assembly was removed; otherwise, false.

TryGet(string, IEnumerable<string>, IEnumerable<string>, out byte[])

Tries to retrieve a cached assembly based on extension, sources, and references.

bool TryGet(string ext, IEnumerable<string> sources, IEnumerable<string> refs, out byte[] assembly)

Parameters

ext string

The file extension used in key generation.

sources IEnumerable<string>

The source code files.

refs IEnumerable<string>

The referenced assemblies.

assembly byte[]

When this method returns, contains the cached assembly if found; otherwise, null.

Returns

bool

true if the assembly was retrieved from the cache; otherwise, false.