user3568783
user3568783

Reputation:

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?

Upvotes: 0

Views: 52

Answers (1)

Narek Mamikonyan
Narek Mamikonyan

Reputation: 4611

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

Upvotes: 0

Related Questions