I use angular-cache with localStorage to save articles locally in html5. The documentation states that there is an option called "capacity":
capacity
Maximum number of items a cache can hold. Adding more items
than the capacity will cause the cache to operate like an LRU cache,
removing the least recently used items to stay under capacity.
Default: Number.MAX_VALUE.
Since I only want to store a max of 20 articles, I configure like this:
After using my app for a while I suddenly noticed that it stopped working because localStorage limit quota was reached. When I printed console.log(localStorage), I saw that there were a lot more than just 20 articles stored to localStorage. So, for some reason angular-cache does not delete the oldest items although the documentation promised the opposite.
So, did I do something wrong or is there a bug in angular-cache?
I use angular-cache with localStorage to save articles locally in html5. The documentation states that there is an option called "capacity":
Since I only want to store a max of 20 articles, I configure like this:
And when I want to get data, I simply do:
After using my app for a while I suddenly noticed that it stopped working because localStorage limit quota was reached. When I printed
console.log(localStorage)
, I saw that there were a lot more than just 20 articles stored to localStorage. So, for some reason angular-cache does not delete the oldest items although the documentation promised the opposite.So, did I do something wrong or is there a bug in angular-cache?