45710c3a by xiemengjun

add TemplateCache

1 parent 8e90ddd5
Showing 1 changed file with 15 additions and 12 deletions
...@@ -4,6 +4,7 @@ import ( ...@@ -4,6 +4,7 @@ import (
4 "fmt" 4 "fmt"
5 "github.com/astaxie/session" 5 "github.com/astaxie/session"
6 _ "github.com/astaxie/session/providers/memory" 6 _ "github.com/astaxie/session/providers/memory"
7 "html/template"
7 "net/http" 8 "net/http"
8 "os" 9 "os"
9 "path" 10 "path"
...@@ -11,18 +12,19 @@ import ( ...@@ -11,18 +12,19 @@ import (
11 ) 12 )
12 13
13 var ( 14 var (
14 BeeApp *App 15 BeeApp *App
15 AppName string 16 AppName string
16 AppPath string 17 AppPath string
17 StaticDir map[string]string 18 StaticDir map[string]string
18 HttpAddr string 19 TemplateCache map[string]*template.Template
19 HttpPort int 20 HttpAddr string
20 RecoverPanic bool 21 HttpPort int
21 AutoRender bool 22 RecoverPanic bool
22 PprofOn bool 23 AutoRender bool
23 ViewsPath string 24 PprofOn bool
24 RunMode string //"dev" or "prod" 25 ViewsPath string
25 AppConfig *Config 26 RunMode string //"dev" or "prod"
27 AppConfig *Config
26 //related to session 28 //related to session
27 SessionOn bool // wheather auto start session,default is false 29 SessionOn bool // wheather auto start session,default is false
28 SessionProvider string // default session provider memory 30 SessionProvider string // default session provider memory
...@@ -36,6 +38,7 @@ func init() { ...@@ -36,6 +38,7 @@ func init() {
36 BeeApp = NewApp() 38 BeeApp = NewApp()
37 AppPath, _ = os.Getwd() 39 AppPath, _ = os.Getwd()
38 StaticDir = make(map[string]string) 40 StaticDir = make(map[string]string)
41 TemplateCache = make(map[string]*template.Template)
39 var err error 42 var err error
40 AppConfig, err = LoadConfig(path.Join(AppPath, "conf", "app.conf")) 43 AppConfig, err = LoadConfig(path.Join(AppPath, "conf", "app.conf"))
41 if err != nil { 44 if err != nil {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!