diff --git a/inc/lib/CCache.class.php b/inc/lib/CCache.class.php index b9633f7..20b60b4 100644 --- a/inc/lib/CCache.class.php +++ b/inc/lib/CCache.class.php @@ -102,7 +102,7 @@ class CCache } /** - * Проверка наличия элемента в кэше + * Проверка наличия элемента в кэше с проверкой срока годности * * @param string $name Имя элемента кэша * @return bool Флаг наличия или отсутствия кэша diff --git a/index.php b/index.php index 4c1cc69..7a29232 100644 --- a/index.php +++ b/index.php @@ -3,7 +3,8 @@ require_once __DIR__ . '/inc/bootstrap.php'; require_once __DIR__ . '/inc/header.php'; $cacheId = md5('CIoT::getDallasArrData_'.$USER['deviceId']); -if(CCache::check($cacheId)) { + +if(CCache::check($cacheId) and CCache::getAge($cacheId) < 60) { $arSensors = CCache::get($cacheId); } else { $arSensors = CIoT::getSensorsArrData($USER['deviceId']);