I am working with React and have some data from the API that I must store/persist so that the API is not called every time the page is rendered, only the first time.
I was wondering what are the main differences between local, session and cache? What I saw was that localStorage is persisted in the browser forever until it is removed by the client, session storage is persisted until the user gets in to the new tab, but cache is an engima to me. If somebody could explain the difference between cache and the first two?
Also, I have a token that expires every 60 minutes and is checked on every API call. If it expires, the user is kicked out and must log on again to see the page. So, after 60 minutes of the user being logged in, I want to delete the persisted API data, kick the user -> user logs in again, call the API, fill the data...What is my best option? Cache, local, session, something else?