Hello I have a website which loads data from an api to show the newest stats. I am storing it for 10 minutes to prevent loading api calls every time. Since there are many api calls it takes at first time like 5-10 seconds to finish loading the website which looks like the website would be down.
Currently I am using pure php for functionalities. There are functions like GetTotalEarnings() - just a file_get_contents($url) to receive a json content and decode it and put it to a table which I can use for 10 minutes. After 10 minutes it will call all apis again to refresh the values (if the page get reloaded of course).
Two examples how looks currently
<h1 class=""><center>Earnings Total: <?php echo GetTotalEarnings() . " (Latest update: " . GetLatestUpdateTime() . ")"; ?></center></h1> <h1 class="">This Month</h1> <div class="col-xs-6 col-sm-6 col-md-3"> <div class="box c1 center-block"> <h4 class="blue">Today</h4> <span class="icon blue"><i class="fa fa-usd"></i></span> <span class="price-large blue"><?php echo round(GetTodayEarnings(), 2); ?></span> </div> </div>