Find out since how long the cache has been stored in IndexDB?

891 Views Asked by At

I am using a web application for doing data entry which has a mechanism for storing the data entry form (which is an html form) in the browser cache IndexDB. I am able to see the form in the browser dev tool like so : HTML form saved in IndexDB

I want to know for how long the Index DB will be able to store the form in the browser? Is it possible that it is months since the browser cache was same? Will closing the browser clear the keys? or is this persistent enough storage to last for a few months?

Is it possible to find out when(the exact date or time) the cache entry was made in the IndexDB?

I am asking this because I suspect some discperancy in the form for some of our users as the data being sent is a little different than expected.

Any help would is appreciated.

Thanks

2

There are 2 best solutions below

0
On BEST ANSWER

Databases don't expose the timestamp of when the database record was last modified. That's something the developer needs make the application to store in the database records. For example, one could have created_at and modified_at columns to track when the record was created and when was it last modified.

IndexedDB is a persistent client storage API, so yes, data will stay permanently unless the user clears the browser's cache.

If there is some discrepancy in the form being sent, I would look at the caching strategy. Offline data caching is a pretty broad topic (also I don't know much about your application), but Google's Offline Cookbook is a good place to start digging in this topic, as long as caching strategies for your use.

0
On

DHIS2, the application you are referring to, has an application you and other users can use to clear any cached data. This app is named "Browser Cache Cleaner", and gives you a list of different things to clear. I would try this app and see if your users still have these issues.