user3569641
user3569641

Reputation: 922

Node.js/Express local disk caching

I have data from my firebase database. I want to cache it as json file so I don't need to query it every time the user access my web app.

This module is good https://www.npmjs.com/package/apicache but it doesn't cache it locally. It is good since it will check if the cache is already in there , if not , you can perform queries to the db. Can you recommend me good local caching. I dont need to put it in memory cos the json file is quite big.

Upvotes: 1

Views: 2782

Answers (2)

Mohamed Allal
Mohamed Allal

Reputation: 20870

That doesn't answer the exact asked question. But for the people that are searching for a simple in disk cache.

I will save you time. Here is the best package i found https://www.npmjs.com/package/flat-cache

(flashing capability (save()), you can precise cache directory, by default it fallback to .cache directory in the package folder in node_module. Which is good hidden place, & generally no permission problem, Can be accessed from multiple programs, over 5 million down, ...).

Upvotes: 4

Talha Awan
Talha Awan

Reputation: 4619

You can download and run redis which is, to quote from their site:

Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker.

It's one of the best for the purpose of caching.

There's a popular npm package you can use redis with.

Upvotes: 1

Related Questions