Skip to content

Step-8 Template Caching

Compare
Choose a tag to compare
@DehuaZhao DehuaZhao released this 18 Aug 14:51
  • Refactor to call ParseFiles once at program initialization, parsing all templates into a single *Template.
  • Create the global variable named templates, and initialize it with ParseFiles.
  • Modify the renderTemplate function to call the templates.ExecuteTemplate method with the name of the appropriate template.