mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 10:27:06 +00:00
more checks about creating new instance of controller on each request - this time if all bindings are static then set them to the initial-devpassed controller and if the total number of lengths are equal with these static dependencies then we ignore the injector and use the initial controller on each request - maximize the performance when simple controller is used - need more cleanup before new release but I hope until Christmas iris developers will be amazed
Former-commit-id: 32ed69368d1df2c25cdb712bb7f0cf47b2e36c05
This commit is contained in:
@@ -97,6 +97,17 @@ func (s *StructInjector) InjectElem(destElem reflect.Value, ctx ...reflect.Value
|
||||
}
|
||||
}
|
||||
|
||||
func (s *StructInjector) InjectElemStaticOnly(destElem reflect.Value) (n int) {
|
||||
for _, f := range s.fields {
|
||||
if f.Object.BindType != Static {
|
||||
continue
|
||||
}
|
||||
destElem.FieldByIndex(f.FieldIndex).Set(f.Object.Value)
|
||||
n++
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (s *StructInjector) New(ctx ...reflect.Value) reflect.Value {
|
||||
dest := reflect.New(s.elemType)
|
||||
s.InjectElem(dest, ctx...)
|
||||
|
||||
Reference in New Issue
Block a user