In my website i have some pages, that makes connections to 3-4 sites and checks the results with my database and gathers a full table. This table includes all the data that the visitor would need.
You can think it as scores table of latest 100 basketball, football and valleyball matches. Users see who won, latest score, location of game, bets data etc.
The sources of data changes every 15 minutes or so. So if the user reloads the page in this period, after many CPU consuming and database querying he will see nearly the same table. (There exist small differences)
I don't save table data into my web storage, because the data is invalid after 1 hour.
My concern is, if visitor reloads the page, this process will be done again again. How can i make solve this?
First ideas that come to my mind:
- Saving page data in localStorage of browser. Storing last access date of page in cookie. And when the page is reloaded, checking the time difference. If smaller than 15 minutes than get data from local storage and show same page. But in this scenario. I will be limited to 5 mb storage limit and browser compatibilities.
- Saving page data in my database and show from there. The problem of this is, the data is nearly 200 entries per page. When i use this model in 50 pages, i will have too much tables and data, where the data will be invalid in an hour.
- Saving page data in my web storage. This is better option in beginning. But is not scalable. When visitor number becomes big, this won't be maintainable.
I would be happy if you can share some ideas, or better practices. Thank you