Giter VIP home page Giter VIP logo

node-cache's Introduction

node-cache

A simple cache implementation in Node.js

Motivation

I know: there are several good modules in npm world but sometimes we don't have enough flexibility in terms of customizations. In my case I invested more time trying to tweak an existing module than develop my own.

Cache data can be as easy as a collection in memory that holds our most used records for the whole life cycle of our web app. For sure, that approach does not scale if we our web app receives several hits or if we have a huge amount of records to load in memory.

There are cache at different levels such as web or persistence. This implementation will cache data at persistence layer.

Take this implementation as a starting point. Probably won't be the most optimized solution to resolve your problem. There's not magic, you will have to spend some time until you get good results in terms of performance.

Among others reasons you will cache because:

  • Reduce response time
  • Reduce stress of your database
  • Save money: less CPU, less memory, less instances, etc.

Available commands

npm install npm test npm start

Open browser

http://localhost:3000

See step by step: https://javaniceday.com/2019/12/03/cache-implementation-in-node-js/

node-cache's People

Contributors

andrescanavesi avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.