func (c *Cachy) GetString(file string) string {
	return c.stringTemplates[file]
}
GetString returns the string representation of the given template.
package cachy
import (
	"bytes"
	"crypto/md5"
	"errors"
	"fmt"
	"html/template"
	"io"
	"io/ioutil"
	"net/http"
	"os"
	"path/filepath"
	"strings"
)
type Cachy struct {
	funcs           template.FuncMap
	templates       map[string]*template.Template
	multiTmpls      map[string]*template.Template
	stringTemplates map[string]string
	checksums       map[string][]byte
	folders         []string
	ext             string
	debug           bool
	allowDuplicates bool
	recursive       bool
	wDir            string
	reloadURL       string
	SSE             *broker
}
type Params struct {
	URL        string
	Ext        string
	Duplicates bool
	Recursive  bool
}
const errAlreadyUpdated = "already updated"
func New(p *Params, funcs template.FuncMap, folders ...string) (c *Cachy, err error) {
	c = &Cachy{}
	c.bindBroker()
	if p != nil {
		c.allowDuplicates = p.Duplicates
		c.recursive = p.Recursive
		c.ext = "." + p.Ext
		c.reloadURL = p.URL
		if strings.HasPrefix(p.Ext, ".") {
			return nil, errors.New("extension can't start with a '.'")
		}
	} else {
		c.ext = ".html"
		c.reloadURL = "/hotreload"
	}
	c.templates = make(map[string]*template.Template)
	c.multiTmpls = make(map[string]*template.Template)
	c.stringTemplates = make(map[string]string)
	c.checksums = make(map[string][]byte)
	c.funcs = template.FuncMap{}
	if c.reloadURL != "" {
		c.funcs["reloadScript"] = func() template.HTML {
			src := `<script>
  var client = new EventSource("` + c.reloadURL + `")
  client.onmessage = function (msg) {
    location.reload();
  }
</script>
`
			return template.HTML(src)
		}
	}
	for k, v := range funcs {
		if _, exists := c.funcs[k]; exists {
			return nil, fmt.Errorf("cachy: function '%s' already exists", k)
		}
		c.funcs[k] = v
	}
	c.wDir, err = os.Getwd()
	if err != nil {
		return
	}
	var noExplFolders bool
	if len(folders) == 0 {
		folders, err = walkDir(c.wDir)
		if err != nil {
			return
		}
		noExplFolders = true
	}
	if c.recursive && !noExplFolders {
		var toAdd []string
		for _, v := range folders {
			toAdd, err = walkDir(v)
			if err != nil {
				return
			}
			for k, s := range toAdd {
				toAdd[k] = filepath.Join(v, s)
			}
			c.folders = append(c.folders, toAdd...)
		}
		c.folders = uniquePaths(c.folders)
	} else {
		c.folders = folders
	}
	return c, c.load()
}
func (c *Cachy) Execute(w io.Writer, data interface{}, files ...string) (err error) {
	if v, ok := w.(http.ResponseWriter); ok {
		v.Header().Set("Content-Type", "text/html; charset=utf-8")
	}
	switch l := len(files); {
	case l == 0:
		return errors.New("Cachy: there are no templates to execute")
	case l == 1:
		return c.templates[files[0]].Execute(w, data)
	default:
		return c.executeMultiple(w, data, files)
	}
}