Skip to content

Session Keeper

Oscar Soto edited this page Oct 22, 2024 · 4 revisions

SessionKeeper.cs

The SessionKeeper is where all the sessions of your application are stored.

The keeper uses a Singleton in the application that has a ConcurrentDictionary<string, SessionState> where the session states of each user are stored. ConcurrentDictionary prevents session access issues among users interacting with the application at the same time.

To access the information of the user in session, the keeper requires the unique key provided to that user's browser once they log in. This key is provided by the SessionProvider, which in turn will retrieve the session state to deserialize the required object in the application.

diagram-1

The keeper only retrieves, retains, and removes the session states of users. Each session state manages its own information in a separate dictionary. The keeper can check if the session state has expired, which is useful for determining whether to remove or update it.

Clone this wiki locally