$database]); self::$cache = new Psr16Adapter('redis', $config); } catch (PhpfastcacheDriverException $ex) { // Fallback to files based cache self::$cache = new Psr16Adapter('files'); } } } protected function saveToCache($data, $key = '') { if ($key) { $key = "_$key"; } global $lang; $cacheKey = str_replace("\\", "_", \get_called_class() . $key . "_$lang"); self::$cache->set($cacheKey, $data, 3600); } protected function getFromCache($key = '') { if ($key) { $key = "_$key"; } global $lang; $cacheKey = str_replace("\\", "_", \get_called_class() . $key . "_$lang"); $cachedData = self::$cache->get($cacheKey); return $cachedData; } }