capacity does not work on often reload
Closed this issue · 9 comments
capacity setted to 10
cache.keys().length = 135
on every page reload it requests resource and put into cache
this code does not work because $$lruHeap.size() equals to 1
if ($$lruHeap.size() > this.$$capacity) {
this.remove($$lruHeap.peek().key);
}
so capacity does not remove old items if they does not expire
What does often reload
mean?
Page reload. So every time cache initialized again.
I need to see your entire cache configuration. Code examples please. Version please. Even better, a plunker that demonstrates the issue. Details!
capacity:10
maxAge: week
storageMode:localstorage
on every page load http get: request?random puts on the cache
so if i make 1000 loads it make 1000 entries in localstorage
Could you please fork this plunker and demonstrate the issue? http://plnkr.co/edit/RXWGpYqRAfKPS6R38MXs?p=preview
Refresh result and see as keys count exceed capacity
http://plnkr.co/edit/6zyAvLYTDeHJSbCvUllF?p=preview
Indeed it does.
Can you try 4.4.0 and see if it works better?
You can try the same plunker. Result the same.