improve template cache for ParseContent function of package gview

This commit is contained in:
John
2020-03-21 23:42:34 +08:00
parent 41a9e91b4c
commit a6a01fd7f2

View File

@ -174,7 +174,7 @@ func (view *View) ParseContent(content string, params ...Params) (string, error)
return "", nil
}
err := (error)(nil)
key := fmt.Sprintf("%s_%v", gCONTENT_TEMPLATE_NAME, view.delimiters)
key := fmt.Sprintf("%s_%v_%v", gCONTENT_TEMPLATE_NAME, view.delimiters, view.config.AutoEncode)
tpl := templates.GetOrSetFuncLock(key, func() interface{} {
if view.config.AutoEncode {
return htmltpl.New(gCONTENT_TEMPLATE_NAME).Delims(view.delimiters[0], view.delimiters[1]).Funcs(view.funcMap)