setWorkingDir(PATH_LIB_CACHES); $cache = $cacheFac->create(Configuration::getConfig('cache', 'type')); $cache->setScope('error_reporting'); $cache->setkey($bridgeName . '_' . $code); $cache->purgeCache(86400); // 24 hours if($report = $cache->loadData()) { $report = json_decode($report, true); $report['time'] = time(); $report['count']++; } else { $report = array( 'error' => $code, 'time' => time(), 'count' => 1, ); } $cache->saveData(json_encode($report)); return $report['count']; }