Can I lose data in indexeddb?

Viewed 194

We are implementing offline capabilities for our app. The app takes images, and while offline it stores them in indexeddb until the device is online again and then syncs the images up.

From what I understand indexeddb can be allocated to 50% of the available space on the device (https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Browser_storage_limits_and_eviction_criteria#Storage_limits). So if the device has 2 GB free space indexeddb can use 1 GB. But it has to share 1 GB across ALL origins. www.site.com, app.site.com, www.another.com all counts as single origins so in this case the three origins are allowed to take opp 333 MB.

But does the LRU policy simply delete it (https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Browser_storage_limits_and_eviction_criteria#LRU_policy)? So while offline I took a lot of pictures in my offline app. All three apps is at 99% capacity (330 MB). Still while offline, I open the camera app and records some 4K video with my phone. Now free space is 100 MB.

What happens? Is there a background service that now goes thru all the indexeddbs as described in the policy and frees up memory in the background? With 100 MB free space, indexeddb is given 50 MB total, and with three apps that is 16 MB, way less than 330 MB that they currently have stores. Does it simply get deleted, and in this case all of them are deleted as that is the only way to get under the limit again?

0 Answers
Related