[IMPROVED] non-auto expire caches added
This commit is contained in:
parent
fe9c706020
commit
6b46385584
@ -657,9 +657,9 @@ class Statistics extends Base {
|
|||||||
**/
|
**/
|
||||||
public function getTopContributors($type='shares', $limit=15) {
|
public function getTopContributors($type='shares', $limit=15) {
|
||||||
$this->debug->append("STA " . __METHOD__, 4);
|
$this->debug->append("STA " . __METHOD__, 4);
|
||||||
if ($this->getGetCache() && $data = $this->memcache->get(__FUNCTION__ . $type . $limit)) return $data;
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'shares':
|
case 'shares':
|
||||||
|
if ($this->getGetCache() && $data = $this->memcache->get(__FUNCTION__ . $type . $limit)) return $data;
|
||||||
if ($data = $this->memcache->get(STATISTICS_ALL_USER_SHARES)) {
|
if ($data = $this->memcache->get(STATISTICS_ALL_USER_SHARES)) {
|
||||||
// Use global cache to build data, if we have any data there
|
// Use global cache to build data, if we have any data there
|
||||||
if (!empty($data['data']) && is_array($data['data'])) {
|
if (!empty($data['data']) && is_array($data['data'])) {
|
||||||
@ -700,6 +700,7 @@ class Statistics extends Base {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'hashes':
|
case 'hashes':
|
||||||
|
if ($this->getGetCache() && $data = $this->memcache->getStatic(__FUNCTION__ . $type . $limit)) return $data;
|
||||||
$stmt = $this->mysqli->prepare("
|
$stmt = $this->mysqli->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
a.username AS account,
|
a.username AS account,
|
||||||
@ -717,7 +718,7 @@ class Statistics extends Base {
|
|||||||
GROUP BY account
|
GROUP BY account
|
||||||
ORDER BY hashrate DESC LIMIT ?");
|
ORDER BY hashrate DESC LIMIT ?");
|
||||||
if ($this->checkStmt($stmt) && $stmt->bind_param("i", $limit) && $stmt->execute() && $result = $stmt->get_result())
|
if ($this->checkStmt($stmt) && $stmt->bind_param("i", $limit) && $stmt->execute() && $result = $stmt->get_result())
|
||||||
return $this->memcache->setCache(__FUNCTION__ . $type . $limit, $result->fetch_all(MYSQLI_ASSOC));
|
return $this->memcache->setStaticCache(__FUNCTION__ . $type . $limit, $result->fetch_all(MYSQLI_ASSOC));
|
||||||
return $this->sqlError();
|
return $this->sqlError();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user