From f87b29c0867967d1ea9fc5ea02f346e1180bf4e9 Mon Sep 17 00:00:00 2001 From: rsgrinko Date: Mon, 6 Dec 2021 21:44:38 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BA=D1=8D=D1=88=D0=B8=D1=80=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/lib/CDB.class.php | 1 + index.php | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) 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); +} + ?>