RazorEngine un-cache compiled templates

后端 未结 3 1298
萌比男神i
萌比男神i 2021-02-07 15:02

Currently, I am using RazorEngine v2.1 as part of a background process that sends templated emails (thousands of them). To speed things up, the templates are compiled with their

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-07 15:20

    It seems that RazorEngine stores cache for compiled templates inside TemplateService instance. So you can recreate new instances of TemplateService from time to time to drop all cached templates.

    You can also consider using my own library which is based on RazorEngine and implements custom caching mechanism with expiration: http://www.nuget.org/packages/Essential.Templating.Razor

提交回复
热议问题