New JSON format on api.php for hashrates

Same as my old pull request, but now using api.php. I added some caching using key number 200 (just guessed a high number and looked around the code to check if it was not being already used).

As my previous request, heavy review is needed.