Do I need to worry about managing the size of html5 localStorage, or will least recently used items be automatically removed?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The short answer
localStoragewill not expire.The long answer
According to the currently published working draft, data should not expire. Specifically, I refer to the beginning of sections 4.2 and 4.3, where it says:
4.2 and 4.3:
Note that in 4.2, it goes on to describe that
sessionStoragewill be deleted when the browser has closed. ButlocalStorageshould not expire because of time. In the editor’s draft, it sayssessionStorage(only) may be deleted if the storage limit is encountered.Of course, each storage space gets 5MiB (a fair bit for textual data), and there will be an exception thrown if you attempt to go over this limit. That makes handling the space requirements quite simple, as you can simply catch the exception and clear the data if need be.