How are templates in RazorEngine cached?
razor
Solution
Currently, after the RazorEngine compiles the templates, they are loaded into memory. These assemblies persist in memory only and do not continue beyond the lifetime of the application.
I am considering adding in support for compiling these assemblies to files, but that'll be a future version.
If you call `Razor.Parse` and pass in a name for the template, it will attempt to
- Check the cache of in-memory assemblies for an assembly with the same name.
- Invalid the cache of the content of the template has changed.
- Cache the newly compiled template.
Problem
When you call `RazorEngine.Razor.Compile()`, where is the compiled template stored? Is it available after the programs been restarted? If there is a memory shortage, will it be dumped? I am using `RazorEngine` in an ASP.NET (MVC) project. Will the precompiled templates be available after the application restarts? Would it make more sense for me to store them in the `HttpContext.Cache`? If I did, then would it make more sense to use a different function (other than `Compile`) that bypasses the internal cache? Is there a way to execute an `ITemplate` and just pass it a model? Does `RazorEngine.Razor.Parse()` do any caching? Or is the template recompiled each time?