Transparent Caching Wrapper for Node

Transparent Caching Wrapper for Node

A simple transparent caching wrapper for Node. Wrap a function with it and call it normal. And the cache stays warm with background updates, so it’s always fast.

A simple transparent caching wrapper for Node. Wrap a function with it and call it normal. And the cache stays warm with background updates, so it’s always fast.


Available on GitHub

Previously I covered a more sophisticated caching solution for Firestore. However, you don’t always need something that complex.

Sometimes you just want an expensive function call to be cached for 5 or 10 minutes to reduce load. This is often the case for read-focused operations where it’s ok if the results are a little stale. Especially things like search results, image caching, certain computationally expensive operations, etc.

For that purpose, I built this transparent caching wrapper.

Features

  • The cache is periodically updated in the background without blocking the primary call. So it’s always fast.
  • Simplicity. Just wrap any function and it becomes cached on the next call.
  • Includes both local LRU cache and Redis cache levels. This improves speed and as a bonus minor network interrupts don’t effect serving from the local cache.

programming typescript redis development nodejs

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

Hire NodeJs Developer

Looking to build dynamic, extensively featured, and full-fledged web applications? **[Hire NodeJs Developer](https://hourlydeveloper.io/hire-dedicated-node-js-developer/ "Hire NodeJs Developer")** to create a real-time, faster, and scalable...

Hire Nodejs Developer

Looking to **hire NodeJS Developer**[https://www.dataeximit.com/node-js-development/](https://www.dataeximit.com/node-js-development/ "https://www.dataeximit.com/node-js-development/") to build a perfect back-end to your website or...

Top Node.js Development Companies and Expert NodeJS Developers

A thoroughly researched list of top NodeJS development companies with ratings & reviews to help hire the best Node.JS developers who provide development services and solutions across the world. List of Leading Node.js development Service Providers...

Redis Transactions & Long-Running Lua Scripts

Redis Lua scripting is the popularly recommended approach for handling transactions. Learn the common Lua Scripts error and how to handle for sentinel systems. Redis offers two mechanisms for handling transactions – MULTI/EXEC based transactions and Lua scripts evaluation. Redis Lua scripting is the recommended approach and is fairly popular in usage.

How long does it take to develop/build an app?

This article covers A-Z about the mobile and web app development process and answers your question on how long does it take to develop/build an app.