Skip to content

IUpstreamSession

Martin Halliday edited this page Aug 12, 2016 · 2 revisions

Session middleware does not have to implement IUpstreamSession but any full featured implementation should. Session middleware that implements this interface is providing a way for other downstream middleware to tell the session middleware if session is required or not for a request. This allows the session middleware to skip loading session information where it is not required which is a huge performance benefit in certain scenarios.

This interface is part of the upstream communication mechanism that allows downstream middleware to communicate back upstream before the upstream middleware processes the request.

For example middleware that serves static files probably does not need session to correctly handle requests. In this case if the static file middleware determines that the request is for a static file, it can use the IUpstreamSession interface to tell the session middleware to not bother retrieving session from the session store.

Clone this wiki locally