aspnetcore/src/Microsoft.AspNet.Mvc.Razor/Compilation/ICompilerCache.cs

24 lines
995 B
C#

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNet.Mvc.Razor.Compilation
{
/// <summary>
/// Caches the result of runtime compilation of Razor files for the duration of the app lifetime.
/// </summary>
public interface ICompilerCache
{
/// <summary>
/// Get an existing compilation result, or create and add a new one if it is
/// not available in the cache or is expired.
/// </summary>
/// <param name="relativePath">Application relative path to the file.</param>
/// <param name="compile">An delegate that will generate a compilation result.</param>
/// <returns>A cached <see cref="CompilationResult"/>.</returns>
CompilerCacheResult GetOrAdd(
string relativePath,
Func<RelativeFileInfo, CompilationResult> compile);
}
}