jmdobry/angular-cache

Cache not being fully emptied if using localStorage and multiple web pages

Closed this issue · 2 comments

Hello,

I noticed a weird behaviour while testing my app (which shares the state of the cache among many browser tabs).

If one of the tabs clears the localStorage cache, then the cache is emptied for that tab but the others still have the state of the $http calls in the $$promises object. Even worse when I trigger a cache.removeAll() from those others caches since the keys are already gone there is no proper way to get ride of this inconsistent state being hold in the $$promises object.

I solved the problem by adding the following line to the removeAll() function
$$promises = {}

Regards

That was quick! Thanks!

I am currently using chrome, the line $$promises = {} seems to be on the src code Im using. I have tried
removeall
destroyall, destroy(id)
clearall
but the localstorage is not erased.