1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-17 09:57:01 +00:00

replace the redis library we used with another one, no performance differences but most options for connections pooling and read/write/connect timeout (two config fields are changed as well)

relative to: https://github.com/kataras/iris/issues/1285


Former-commit-id: c20530cd67144ab8d1c9325807fe5c13268fa428
This commit is contained in:
Gerasimos (Makis) Maropoulos
2019-06-22 14:46:20 +03:00
parent 1f9ead426e
commit b71d4032e6
11 changed files with 419 additions and 444 deletions

View File

@@ -25,7 +25,7 @@ type AmberEngine struct {
templateCache map[string]*template.Template
}
var _ Engine = &AmberEngine{}
var _ Engine = (*AmberEngine)(nil)
// Amber creates and returns a new amber view engine.
func Amber(directory, extension string) *AmberEngine {
@@ -77,7 +77,7 @@ func (s *AmberEngine) AddFunc(funcName string, funcBody interface{}) {
}
// Load parses the templates to the engine.
// It's alos responsible to add the necessary global functions.
// It is responsible to add the necessary global functions.
//
// Returns an error if something bad happens, user is responsible to catch it.
func (s *AmberEngine) Load() error {

View File

@@ -88,7 +88,7 @@ func (dal *tDjangoAssetLoader) Get(path string) (io.Reader, error) {
return bytes.NewBuffer(res), nil
}
// DjangoEngine contains the amber view engine structure.
// DjangoEngine contains the django view engine structure.
type DjangoEngine struct {
// files configuration
directory string
@@ -106,7 +106,7 @@ type DjangoEngine struct {
templateCache map[string]*pongo2.Template
}
var _ Engine = &DjangoEngine{}
var _ Engine = (*DjangoEngine)(nil)
// Django creates and returns a new amber view engine.
func Django(directory, extension string) *DjangoEngine {
@@ -195,7 +195,7 @@ func (s *DjangoEngine) RegisterTag(tagName string, fn TagParser) error {
}
// Load parses the templates to the engine.
// It's alos responsible to add the necessary global functions.
// It is responsible to add the necessary global functions.
//
// Returns an error if something bad happens, user is responsible to catch it.
func (s *DjangoEngine) Load() error {

View File

@@ -22,7 +22,7 @@ func getLayout(layout string, globalLayout string) string {
// Engine is the interface which all view engines should be implemented in order to be registered inside iris.
type Engine interface {
// Load should load the templates from a directory of by binary(assets/go-bindata).
// Load should load the templates from a physical system directory or by an embedded one (assets/go-bindata).
Load() error
// ExecuteWriter should execute a template by its filename with an optional layout and bindingData.
ExecuteWriter(w io.Writer, filename string, layout string, bindingData interface{}) error

View File

@@ -27,6 +27,8 @@ type HandlebarsEngine struct {
templateCache map[string]*raymond.Template
}
var _ Engine = (*HandlebarsEngine)(nil)
// Handlebars creates and returns a new handlebars view engine.
func Handlebars(directory, extension string) *HandlebarsEngine {
s := &HandlebarsEngine{
@@ -95,7 +97,7 @@ func (s *HandlebarsEngine) AddFunc(funcName string, funcBody interface{}) {
}
// Load parses the templates to the engine.
// It's alos responsible to add the necessary global functions.
// It is responsible to add the necessary global functions.
//
// Returns an error if something bad happens, user is responsible to catch it.
func (s *HandlebarsEngine) Load() error {

View File

@@ -13,32 +13,30 @@ import (
"time"
)
type (
// HTMLEngine contains the html view engine structure.
HTMLEngine struct {
// files configuration
directory string
extension string
assetFn func(name string) ([]byte, error) // for embedded, in combination with directory & extension
namesFn func() []string // for embedded, in combination with directory & extension
reload bool // if true, each time the ExecuteWriter is called the templates will be reloaded, each ExecuteWriter waits to be finished before writing to a new one.
// parser configuration
options []string // text options
left string
right string
layout string
rmu sync.RWMutex // locks for layoutFuncs and funcs
layoutFuncs map[string]interface{}
funcs map[string]interface{}
// HTMLEngine contains the html view engine structure.
type HTMLEngine struct {
// files configuration
directory string
extension string
assetFn func(name string) ([]byte, error) // for embedded, in combination with directory & extension
namesFn func() []string // for embedded, in combination with directory & extension
reload bool // if true, each time the ExecuteWriter is called the templates will be reloaded, each ExecuteWriter waits to be finished before writing to a new one.
// parser configuration
options []string // text options
left string
right string
layout string
rmu sync.RWMutex // locks for layoutFuncs and funcs
layoutFuncs map[string]interface{}
funcs map[string]interface{}
//
middleware func(name string, contents []byte) (string, error)
Templates *template.Template
//
}
)
//
middleware func(name string, contents []byte) (string, error)
Templates *template.Template
//
}
var _ Engine = &HTMLEngine{}
var _ Engine = (*HTMLEngine)(nil)
var emptyFuncs = template.FuncMap{
"yield": func() (string, error) {
@@ -132,8 +130,7 @@ func (s *HTMLEngine) Option(opt ...string) *HTMLEngine {
}
// Delims sets the action delimiters to the specified strings, to be used in
// subsequent calls to Parse, ParseFiles, or ParseGlob. Nested template
// definitions will inherit the settings. An empty delimiter stands for the
// templates. An empty delimiter stands for the
// corresponding default: {{ or }}.
func (s *HTMLEngine) Delims(left, right string) *HTMLEngine {
s.left, s.right = left, right