I have Json file I need to look for specific value (file is pretty big) and I want to turn this json into array so doing so would be easier and faster. BUT what is the best way to save this array? so I wont need to run over this json every time and it will be saved until recycle or service restart? (node js project)
1) Use Redis recommended
Pros:
node
process.
Cons:
2) Use database preferred MongoDB ,
Pros:
Save/Load
objects easily since MongoDB
supports JSON. Redis
pros Cons:
3) Use Files not recommended , When your application start/restart
, load your objects form file into global array, and when close/shutdown
your application dump your objects from global array back into file.
Pros:
Cons:
At the end it's your choice, if the speed matters choose Redis
, if you want the easy way choose mongoDB
. If it's not a problem losing some of your data go for Files
. Also you can mix between number 2 and 3 .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.