-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(Local Storage) Catch and manage exception when local storage size is reached #139
Conversation
I will review this. I also wanted to point out that this may not work in all situations, as |
I agree. Thanks for the review. |
I can't merge this PR, I think it needs to be updated with master. |
+1 for this. |
With this PR, if the max LS size is reached during a put, I remove 30% of the cache and do the put. We can imagine relying on memory in this case, but I think it would confuse the user by having some data in memory (flushable by F5) and others in LS... only based on technical considerations. |
Conflicts: dist/angular-cache.js src/DSCache/put.js
was this issue ever resolved? |
"capacity" does not prevent from having a maximum size reached exception with the local storage.
Here, the idea is to catch this exception (around setItem), compute the size of the item that is provoking the exception. Then, removing from the cache oldest item until there are enough space for adding this new item.