Revert "[FEATURE] Added Ajax JSON Memcache"
This reverts commit bd8796b824.
It turns out it's pretty much useless as long as the data passed to
get_json is not also being cached.
This commit is contained in:
parent
bd8796b824
commit
c8f19d2841
@ -30,19 +30,13 @@ class Api extends Base {
|
||||
* @return string JSON object
|
||||
**/
|
||||
function get_json($data, $force=false) {
|
||||
// Create a request specific memcache key
|
||||
$sMemcacheKey = @$_REQUEST['page'] . '_' . @$_REQUEST['action'] . '_' . __FUNCTION__ . '_' . @$SESSION['USERDATA']['id'] . '_' . $_SESSION['REMOTE_ADDR'];
|
||||
if ($this->setting->getValue('statistics_ajax_cache') && $json_data = $this->memcache->get($sMemcacheKey)) return $json_data;
|
||||
$json_data =json_encode(
|
||||
return json_encode(
|
||||
array( $_REQUEST['action'] => array(
|
||||
'version' => $this->api_version,
|
||||
'runtime' => (microtime(true) - $this->dStartTime) * 1000,
|
||||
'data' => $data
|
||||
)), $force ? JSON_FORCE_OBJECT : 0
|
||||
);
|
||||
if (! $expiration = $this->setting->getValue('statistics_ajax_cache_expiration')) $expiration = 10;
|
||||
if ($this->setting->getValue('statistics_ajax_cache'))
|
||||
return $this->memcache->setCache($sMemcacheKey, $json_data, $expiration);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,5 +63,4 @@ $api = new Api();
|
||||
$api->setConfig($config);
|
||||
$api->setUser($user);
|
||||
$api->setSetting($setting);
|
||||
$api->setMemcache($memcache);
|
||||
$api->setStartTime($dStartTime);
|
||||
|
||||
@ -37,9 +37,6 @@ class Base {
|
||||
public function setSetting($setting) {
|
||||
$this->setting = $setting;
|
||||
}
|
||||
public function setMemcache($memcache) {
|
||||
$this->memcache = $memcache;
|
||||
}
|
||||
public function setBitcoin($bitcoin) {
|
||||
$this->bitcoin = $bitcoin;
|
||||
}
|
||||
|
||||
@ -116,20 +116,6 @@ $aSettings['statistics'][] = array(
|
||||
'name' => 'statistics_ajax_data_interval', 'value' => $setting->getValue('statistics_ajax_data_interval'),
|
||||
'tooltip' => 'Time in minutes, interval for hashrate and sharerate calculations. Higher intervals allow for better accuracy at a higer server load.'
|
||||
);
|
||||
$aSettings['statistics'][] = array(
|
||||
'display' => 'Ajax Caching', 'type' => 'select',
|
||||
'options' => array('0' => 'No', '1' => 'Yes'),
|
||||
'default' => 0,
|
||||
'name' => 'statistics_ajax_cache', 'value' => $setting->getValue('statistics_ajax_cache'),
|
||||
'tooltip' => 'Enable or disable the Ajax cache for memcache.'
|
||||
);
|
||||
$aSettings['statistics'][] = array(
|
||||
'display' => 'Ajax Cache Expiration', 'type' => 'select',
|
||||
'options' => array('5' => '5', '10' => '10', '20' => '20', '40' => '40', '60' => '60'),
|
||||
'default' => 10,
|
||||
'name' => 'statistics_ajax_cache_expiration', 'value' => $setting->getValue('statistics_ajax_cache_expiration'),
|
||||
'tooltip' => 'Change expiration time for memcache keys.'
|
||||
);
|
||||
$aSettings['statistics'][] = array(
|
||||
'display' => 'Block Statistics Count', 'type' => 'text',
|
||||
'size' => 25,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user