-
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Here is a snippet of the template rendering
var options = new TemplateOptions();
options.CultureInfo = System.Globalization.CultureInfo.CurrentUICulture;
options.MemberAccessStrategy = new UnsafeMemberAccessStrategy();
var context = new TemplateContext(model, options, allowModelMembers: true);
var template = _fluidParser.Parse(source);
return template.Render(context);TemplateOptions should be reused. It is expensive to create new instances as caches are not reused. Register this as a singleton.
Template results from Parse should be reused. If the same templates are parsed then it makes sense to create a local cache of the parsed templates. A simple dictionary based on the source, or a key derived from it (filename, timestamp, ...) in a constrained IMemoryCache (time and size bound), would be ideal.
Metadata
Metadata
Assignees
Labels
No labels