1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 18:37:05 +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:
Gerasimos (Makis) Maropoulos
2017-12-18 00:16:10 +02:00
parent 40b40fa7d3
commit d5a38a0cd6
19 changed files with 232 additions and 117 deletions

View File

@@ -15,13 +15,13 @@ type SessionController struct {
Session *sessions.Session
}
// BeforeActivate called, once per application lifecycle NOT request,
// BeforeActivation called, once per application lifecycle NOT request,
// every single time the dev registers a specific SessionController-based controller.
// It makes sure that its "Manager" field is filled
// even if the caller didn't provide any sessions manager via the `app.Controller` function.
func (s *SessionController) BeforeActivate(ca *ControllerActivator) {
if didntBindManually := ca.Dependencies.AddOnce(defaultSessionManager); didntBindManually {
ca.Router.GetReporter().Add(
func (s *SessionController) BeforeActivation(b BeforeActivation) {
if didntBindManually := b.Dependencies().AddOnce(defaultSessionManager); didntBindManually {
b.Router().GetReporter().Add(
`MVC SessionController: couldn't find any "*sessions.Sessions" bindable value to fill the "Manager" field,
therefore this controller is using the default sessions manager instead.
Please refer to the documentation to learn how you can provide the session manager`)