Try Playground
Show / Hide Table of Contents

Node.js Sessions Sample Application

After successfully configuring NCache, you are now ready to use it within your Node.js applications. NCache being an in-memory distributed cache provides the feature of Node.js Sessions for high performance, efficiency, and scalability.

As HTTPs 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. Node.js uses express-session middleware to manage sessions.

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 reliable and scalable storage for your session persistence, then NCache is the best available option. Using NCache, your cache cluster nodes can cater to extreme transaction loads, with which you can achieve as much scalability as possible.

To further learn about how to use Node.js sessions, please refer to Node.js Sessions.

Important

Before getting started with NCache in Node.js, take the following prerequisites under consideration:

  • Node.js version 14.15.3 or above is installed with Chocolatey.
  • JDK 17 is installed.
  • The Environment Variable for Java is set.

NCache Demonstration with Node.js Sessions Sample

Follow the steps mentioned here to see how NCache is used to perform various operations on your application's data:

Step 1: Download Sample from GitHub

Go to the NCache repository on GitHub and download the entire repository or the sample you are interested in.

Step 2: Launch the Project

Launch your Node.js sample application in a Node.js IDE of your choice. For example, Microsoft Visual Studio Code.

Step 3: Configure Settings

After launching the project, locate and open the app-config.json file where you have to change the name of the cache to the cache you created before.

Step 4: Build and Run Sample

After configuring the cache settings, build the sample application for further use.

Step 5: Visualize Output

Play around with the output being shown. You will see that the data is being stored in session according to your given inputs.

See Also

Use NCache for .NET Data Caching
Use NCache for ASP.NET Core Caching
Use NCache for Java Data Caching

In This Article
  • NCache Demonstration with Node.js Sessions Sample
    • Step 1: Download Sample from GitHub
    • Step 2: Launch the Project
    • Step 3: Configure Settings
    • Step 4: Build and Run Sample
    • Step 5: Visualize Output
  • See Also

Contact Us

PHONE

+1 (214) 764-6933   (US)

+44 20 7993 8327   (UK)

 
EMAIL

sales@alachisoft.com

support@alachisoft.com

NCache
  • NCache Enterprise
  • NCache Professional
  • Edition Comparison
  • NCache Architecture
  • Benchmarks
Download
Pricing
Try Playground

Deployments
  • Cloud (SaaS & Software)
  • On-Premises
  • Kubernetes
  • Docker
Technical Use Cases
  • ASP.NET Sessions
  • ASP.NET Core Sessions
  • Pub/Sub Messaging
  • Real-Time ASP.NET SignalR
  • Internet of Things (IoT)
  • NoSQL Database
  • Stream Processing
  • Microservices
Resources
  • Magazine Articles
  • Third-Party Articles
  • Articles
  • Videos
  • Whitepapers
  • Shows
  • Talks
  • Blogs
  • Docs
Customer Case Studies
  • Testimonials
  • Customers
Support
  • Schedule a Demo
  • Forum (Google Groups)
  • Tips
Company
  • Leadership
  • Partners
  • News
  • Events
  • Careers
Contact Us

  • EnglishChinese (Simplified)FrenchGermanItalianJapaneseKoreanPortugueseSpanish

  • Contact Us
  •  
  • Sitemap
  •  
  • Terms of Use
  •  
  • Privacy Policy
© Copyright Alachisoft 2002 - 2025. All rights reserved. NCache is a registered trademark of Diyatech Corp.
Back to top