Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Cache vs localStorage

In my map application,user clicks on a feature in map and some specific functional data corresponding to that feature is fetched from the server. Data is quite huge and takes time to be fetched over network. As user can re-click a feature, so to avoid the network call, I currently maintain a Map(feature id -> data). But as data is quite huge, so this doesn't seem to be an optimal approach to me as it consumes lots of memory.

I tried to explore alternatives for the solution. I came across Cache and localStorage. I am quite new to frontend development and really don't understand the pros and cons of these approaches. Also, given the data size(quite big I would say), I am not sure which one is a better fit to my usecase.

Which of these two approaches should I go for?

Comments