diff --git a/inc/lib/CDB.class.php b/inc/lib/CDB.class.php index 757b2e3..27b0673 100644 --- a/inc/lib/CDB.class.php +++ b/inc/lib/CDB.class.php @@ -190,6 +190,7 @@ class CDB $endTime = microtime(true); self::$workingTime += ($endTime - $startTime); + if ($result) { return $result; } else { diff --git a/index.php b/index.php index 1d21a4a..ef5dce7 100644 --- a/index.php +++ b/index.php @@ -2,7 +2,14 @@ require_once __DIR__ . '/inc/bootstrap.php'; require_once __DIR__ . '/inc/header.php'; -$arSensors = CIoT::getDallasArrData($USER['deviceId']); +$cacheId = md5('CIoT::getDallasArrData_'.$USER['deviceId']); +if(CCache::checkCache($cacheId)) { + $arSensors = CCache::getCache($cacheId); +} else { + $arSensors = CIoT::getDallasArrData($USER['deviceId']); + CCache::writeCache($cacheId, $arSensors); +} + ?>