API with NestJS #24. Cache With Redis. Running The App in A Node.js Cluster

API with NestJS #24. Cache With Redis. Running The App in A Node.js Cluster

API with NestJS #24. Cache With Redis. Running The App in A Node.js Cluster - We look into using Redis as a cache and run multiple instances of our application with a Node.js cluster.

  • 1.  API with NestJS #1. Controllers, routing and the module structure
  • 2.  API with NestJS #2. Setting up a PostgreSQL database with TypeORM
  • 3.  API with NestJS #3. Authenticating users with bcrypt, Passport, JWT, and cookies
  • 4.  API with NestJS #4. Error handling and data validation
  • 5.  API with NestJS #5. Serializing the response with interceptors
  • 6.  API with NestJS #6. Looking into dependency injection and modules
  • 7.  API with NestJS #7. Creating relationships with Postgres and TypeORM
  • 8.  API with NestJS #8. Writing unit tests
  • 9.  API with NestJS #9. Testing services and controllers with integration tests
  • 10.  API with NestJS #10. Uploading public files to Amazon S3
  • 11.  API with NestJS #11. Managing private files with Amazon S3
  • 12.  API with NestJS #12. Introduction to Elasticsearch
  • 13.  API with NestJS #13. Implementing refresh tokens using JWT
  • 14.  API with NestJS #14. Improving performance of our Postgres database with indexes
  • 15.  API with NestJS #15. Defining transactions with PostgreSQL and TypeORM
  • 16.  API with NestJS #16. Using the array data type with PostgreSQL and TypeORM
  • 17.  API with NestJS #17. Offset and keyset pagination with PostgreSQL and TypeORM
  • 18.  API with NestJS #18. Exploring the idea of microservices
  • 19.  API with NestJS #19. Using RabbitMQ to communicate with microservices
  • 20.  API with NestJS #20. Communicating with microservices using the gRPC framework
  • 21.  API with NestJS #21. An introduction to CQRS
  • 22.  API with NestJS #22. Storing JSON with PostgreSQL and TypeORM
  • 23.  API with NestJS #23. Implementing in-memory cache to increase the performance
  • 24. API with NestJS #24. Cache with Redis. Running the app in a Node.js cluster
  • 25.  API with NestJS #25. Sending scheduled emails with cron and Nodemailer
  • 26.  API with NestJS #26. Real-time chat with WebSockets
  • 27.  API with NestJS #27. Introduction to GraphQL. Queries, mutations, and authentication
  • 28.  API with NestJS #28. Dealing in the N + 1 problem in GraphQL
  • 29.  API with NestJS #29. Real-time updates with GraphQL subscriptions
  • 30.  API with NestJS #30. Scalar types in GraphQL
  • 31.  API with NestJS #31. Two-factor authentication

Redis is a fast and reliable key-value store. It keeps the data in its memory, although Redis, by default, writes the data to the file system at least every 2 seconds.

In the  previous part of this series, we’ve used a cache stored in our application’s memory. While it is simple and efficient, it has its downsides. With applications where performance and availability are crucial, we often run multiple instances of our API. With that, the incoming traffic is load-balanced and redirected to multiple instances.

Unfortunately, keeping the cache within the memory of the application means that multiple instances of our API do not share the same cache. Also, restarting the API means losing the cache. Because of all of that, it is worth looking into Redis.

javascript nestjs typescript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

What is TypeScript? Why TypeScript? and Why Not TypeScript?

TypeScript extends JavaScript by adding Types. There are many great reasons to switch to TypeScript. Especially if your team uses JavaScript. There are some reasons to not use TypeScript as there are with any language or framework.

Building Modern Nodejs Application using Nestjs and TypeScript

Building Modern Nodejs Application using Nestjs and TypeScript - In this article, we will see how to build REST API using Nestjs with TypeScript. Building Modern Nodejs Application using Nestjs and TypeScript

Hire Dedicated JavaScript Developers -Hire JavaScript Developers

Hire dedicated JavaScript Developers who are proficient in AngularJS, ReactJS, NodeJS, & VueJS frameworks. Get flexible hiring models as per your business requirements.

TypeScript Tutorial For JavaScript Developers - TypeScript Basics

TypeScript Tutorial For JavaScript Developers - TypeScript Basics. I will show you guys 4 example of JavaScript code, and how to convert it to TypeScript. This is a typescript beginners tutorial.

Developing REST API Framework using TypeScript and NestJS

Nowadays, web applications are being designed with REST API and front-end. For developing a UI application, now, we have so many popular JavaScript frameworks available, like Angular, React, Vue and many more. For developing REST API, we have multiple options too. If we select Java as a programming language, we have Spring boot; for .NET, we have REST API Framework; if we choose JavaScript, then we have ExpressJS, HapiJS, and NestJS etc