marifemac marifemac - 1 year ago 65
AngularJS Question

What is the lifetime of the cache when using the property in an $http get?

If I set the $http.get to have a cache like this:

$http.get(url, { cache: true}).success(...);

Then where is the data stored. Is there an object I can check to see this data. Also what is the lifetime of the data? Would the data be lost when I reload a page in the application?

Answer Source

It's keeping so while alive your html page, if the page has been closed or refreshed it will be removed, if you want to clear your cache you should use $cacheFactory provider's removeAll() function, if you want cache which will be kept for a long time then you should use localStorage or sessionStorage

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download