// Unexported method to help handle template parsing.  If the cache template bool is set on the config
// struct this method with look in the cache & load the cache upon subsequent encounters.
// This should lower disk access penalties useful for production instances.
Unexported method to help handle template parsing.  If the cache template bool is set on the config
struct this method with look in the cache & load the cache upon subsequent encounters.
This should lower disk access penalties useful for production instances.
// Unexported method to help handle template parsing . If the cache template bool is set on the config // struct this method with look in the cache & load the cache upon subsequent encounters . // This should lower disk access penalties useful for production instances .
func (mr *Renderer) acquireTemplate(key string, tpls ...string) (*template.Template, error) {
	var tpl *template.Template
	var loadErr error
	var ok bool
	if mr.cacheTpls {
		mr.RLock()
		tpl, ok = mr.templateCache[key]
		mr.RUnlock()
		if ok {
			return tpl, nil
		}
	}
	tpl, loadErr = template.New(filepath.Base(tpls[0])).Funcs(mr.tplFuncs).ParseFiles(tpls...)
	if loadErr != nil {
		return nil, loadErr
	}
	if mr.cacheTpls {
		mr.Lock()
		mr.templateCache[key] = tpl
		mr.Unlock()
	}
	return tpl, nil
}
func ( mr * Renderer ) acquireTemplate ( key string , tpls ... string ) ( * template . Template , error ) { var tpl * template . Template var loadErr error var ok bool if mr . cacheTpls { mr . RLock ( ) tpl , ok = mr . templateCache [ key ] mr . RUnlock ( ) if ok { return tpl , nil } } tpl , loadErr = template . New ( filepath . Base ( tpls [ 0 ] ) ) . Funcs ( mr . tplFuncs ) . ParseFiles ( tpls ... ) if loadErr != nil { return nil , loadErr } if mr . cacheTpls { mr . Lock ( ) mr . templateCache [ key ] = tpl mr . Unlock ( ) } return tpl , nil }
Unexported method to help handle template parsing.
Unexported method to help handle template parsing .