1

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.

2 Answers 2

4

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, ...).

Sign up to request clarification or add additional context in comments.

Comments

1

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.

2 Comments

i was looking for a local cache, not in-memory.
Not local I agree, but persists the data in a form of 'snapshot' time to time. Therefore, partially local in a sense and a better option than playing with json files directly. redis.io/topics/persistence , stackoverflow.com/a/19489635

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.