Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does AngularJS store Cache data

I'm building an app using AngularJS. I need to store some data across sessions. I thought the $cacheFactory might be an option. However, I can't figure out where the Cache object actually stores the data.

Can someone tell me how to store data on the client-side across sessions in AngularJS? Is the $cacheFactory even an option for this scenario?

Thank you

like image 248
user3284007 Avatar asked Apr 12 '14 11:04

user3284007


1 Answers

$cacheFactory merely stores the data in a JSON dict (called caches at the time of writing) and the data will be lost as soon as the app is reloaded.

The only persistent storage option you have while remaining browser compatible is cookies. If you support only modern browsers (>IE8), then you can consider using the HTML5 localStorage provided by the browser as well.

like image 177
musically_ut Avatar answered Nov 02 '22 20:11

musically_ut