ICompilerCache Interface

Summary

Caches the result of runtime compilation of Razor files for the duration of the app lifetime.

Syntax

public interface ICompilerCache

GitHub

View on GitHub

interface Microsoft.AspNet.Mvc.Razor.Compilation.ICompilerCache

Methods

GetOrAdd(System.String, System.Func<Microsoft.AspNet.Mvc.Razor.Compilation.RelativeFileInfo, Microsoft.AspNet.Mvc.Razor.Compilation.CompilationResult>)

Get an existing compilation result, or create and add a new one if it is not available in the cache or is expired.

Arguments:
  • relativePath (System.String) – Application relative path to the file.
  • compile (System.Func{Microsoft.AspNet.Mvc.Razor.Compilation.RelativeFileInfo,Microsoft.AspNet.Mvc.Razor.Compilation.CompilationResult}) – An delegate that will generate a compilation result.
Return type:

Microsoft.AspNet.Mvc.Razor.Compilation.CompilerCacheResult

Returns:

A cached [Microsoft.AspNet.Mvc.Razor.Compilation.CompilationResult](Microsoft.AspNet.Mvc.Razor.Compilation.CompilationResult.yml).

CompilerCacheResult GetOrAdd(string relativePath, Func<RelativeFileInfo, CompilationResult> compile)