Node.js Session Caching Benefits and Overview
This feature is only available in NCache Enterprise Edition.
Sessions in Node.js
Applications over the web are session-oriented. For example, when a user logs into a website they start a session and when they log out the session ends. Sessions are used to store that preferred user information on server side using a session id and that session id is then passed onto the user.
As HTTP is a stateless protocol, a web application needs to track requests coming from the same user and store that session related data somewhere. By default, session data is usually stored in memory on the web server. Memory session store data might get wiped out incase the web server goes down or gets restarted. Therefore, usage of external persistence storage is a better option.
Session Management in Node.js
Express is a Node.js web application sever framework specifically designed to build mobile and web applications. It provides various features for their users including management of sessions. Node.js uses express-session middleware to manage sessions. By default, express provides server side session storage but it also gives the facility to make your own custom store whilst the rest stays the same.
NCache as a Session Store
NCache provides a session store for session data storage in Node.js. If your application is running in a web server farm and you need a reliable and scalable storage for your session persistence, then NCache provides you with the following advantages:
- Performance: NCache has high performance as it provides extremely fast response time.
- Scalability: It is an in-memory distributed cache which provides linear scalability. As your cache cluster nodes need to cater extreme transaction loads, you can achieve as much scalability as needed.
- Availability: NCache provides strong distributed cache clusters with no single point of failure.
In this chapter, you will learn how to configure NCache as a session store for your Node.js application.
In This Section
Configure Sessions in Node.js
Explains how to configure and use NCache as a session store for Node.js application.