Refreshing local storage every day

Hi guys!

I have an app with no authentication. It generates an image & text on clicking a button. All working great. I’d now like to make it so the image & text persist for the phone until midnight, then the user generates a new one for the new day.

I was thinking to:

  • Call my API
  • Store the image and text in local storage with the date
  • If they re-open the app, check if there is an entry in local storage for today
  • If so, show the image and text from local storage
  • If not, call the API and store the new image and text

My only concern is that there’s then no way to clear all these storage entries. Is this going to be a huge problem? Or does the phone eventually delete them automatically? Can anyone think of an alternative solution?

Hi there, as a solution, i would think the same thing, but i think that when you set an item to storage with a certain item key and then you go to set a new value to that item key, it replaces (delete the old) the old value with the new (i dont know if im missing something) but ether way, there is always the option to delete the record first so i think you wont have any problems