[IMPROVED] non-auto expire caches added

This commit is contained in:
Sebastian Grewe 2014-01-21 10:56:08 +01:00
parent 8ef419f795
commit fe9c706020

View File

@ -219,7 +219,7 @@ class Statistics extends Base {
**/ **/
public function getCurrentHashrate($interval=180) { public function getCurrentHashrate($interval=180) {
$this->debug->append("STA " . __METHOD__, 4); $this->debug->append("STA " . __METHOD__, 4);
if ($this->getGetCache() && $data = $this->memcache->get(__FUNCTION__)) return $data; if ($this->getGetCache() && $data = $this->memcache->getStatic(__FUNCTION__)) return $data;
$stmt = $this->mysqli->prepare(" $stmt = $this->mysqli->prepare("
SELECT SELECT
( (
@ -236,7 +236,7 @@ class Statistics extends Base {
) )
) AS hashrate ) AS hashrate
FROM DUAL"); FROM DUAL");
if ($this->checkStmt($stmt) && $stmt->bind_param('iiii', $interval, $interval, $interval, $interval) && $stmt->execute() && $result = $stmt->get_result() ) return $this->memcache->setCache(__FUNCTION__, $result->fetch_object()->hashrate); if ($this->checkStmt($stmt) && $stmt->bind_param('iiii', $interval, $interval, $interval, $interval) && $stmt->execute() && $result = $stmt->get_result() ) return $this->memcache->setStaticCache(__FUNCTION__, $result->fetch_object()->hashrate);
return $this->sqlError(); return $this->sqlError();
} }
@ -247,7 +247,7 @@ class Statistics extends Base {
**/ **/
public function getCurrentShareRate($interval=180) { public function getCurrentShareRate($interval=180) {
$this->debug->append("STA " . __METHOD__, 4); $this->debug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__)) return $data; if ($data = $this->memcache->getStatic(__FUNCTION__)) return $data;
$stmt = $this->mysqli->prepare(" $stmt = $this->mysqli->prepare("
SELECT SELECT
( (
@ -264,7 +264,7 @@ class Statistics extends Base {
) )
) AS sharerate ) AS sharerate
FROM DUAL"); FROM DUAL");
if ($this->checkStmt($stmt) && $stmt->bind_param('iiii', $interval, $interval, $interval, $interval) && $stmt->execute() && $result = $stmt->get_result() ) return $this->memcache->setCache(__FUNCTION__, $result->fetch_object()->sharerate); if ($this->checkStmt($stmt) && $stmt->bind_param('iiii', $interval, $interval, $interval, $interval) && $stmt->execute() && $result = $stmt->get_result() ) return $this->memcache->setStaticCache(__FUNCTION__, $result->fetch_object()->sharerate);
return $this->sqlError(); return $this->sqlError();
} }