mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-09-20 18:09:54 +00:00
api: memcache status for 30 second
This commit is contained in:
parent
c3721b77c9
commit
cfc4d59ee7
1 changed files with 14 additions and 2 deletions
|
@ -10,7 +10,15 @@ class ApiController extends CommonController
|
|||
|
||||
public function actionStatus()
|
||||
{
|
||||
if(!LimitRequest('api-status', 10)) return;
|
||||
//if(!LimitRequest('api-status', 10)) return;
|
||||
|
||||
$memcache = controller()->memcache->memcache;
|
||||
$json = memcache_get($memcache, "api_status");
|
||||
|
||||
if (!empty($json)) {
|
||||
echo $json;
|
||||
return;
|
||||
}
|
||||
|
||||
$stats = array();
|
||||
foreach(yaamp_get_algos() as $i=>$algo)
|
||||
|
@ -77,7 +85,11 @@ class ApiController extends CommonController
|
|||
}
|
||||
|
||||
ksort($stats);
|
||||
echo json_encode($stats);
|
||||
|
||||
$json = json_encode($stats);
|
||||
echo $json;
|
||||
|
||||
memcache_set($memcache, "api_status", $json, MEMCACHE_COMPRESSED, 30);
|
||||
}
|
||||
|
||||
public function actionCurrencies()
|
||||
|
|
Loading…
Add table
Reference in a new issue