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.

user3569641
  • 892
  • 1
  • 17
  • 50

2 Answers2

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

Mohamed Allal
  • 17,920
  • 5
  • 94
  • 97
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.

Talha Awan
  • 4,573
  • 4
  • 25
  • 40
  • i was looking for a local cache, not in-memory. – user3569641 Apr 01 '17 at 13:18
  • 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. https://redis.io/topics/persistence , http://stackoverflow.com/a/19489635 – Talha Awan Apr 01 '17 at 13:45