public static function remember($key, $seconds, Closure $callback, $initDir = '/', $basedir = 'cache')
    {
        $debug = \Bitrix\Main\Data\Cache::getShowCacheStat();

        if ($seconds <= 0) {
            try {
                $result = $callback();
            } catch (AbortCacheException $e) {
                $result = null;
            }

            if ($debug) {
                CacheDebugger::track('zero_ttl', $initDir, $basedir, $key, $result);
            }

            return $result;
        }

        $obCache = new CPHPCache();
        if ($obCache->InitCache($seconds, $key, $initDir, $basedir)) {
            $vars = $obCache->GetVars();

            if ($debug) {
                CacheDebugger::track('hits', $initDir, $basedir, $key, $vars['cache']);
            }

            return $vars['cache'];
        }

        $obCache->StartDataCache();
        try {
            $cache = $callback();
            $obCache->EndDataCache(['cache' => $cache]);
        } catch (AbortCacheException $e) {
            $obCache->AbortDataCache();
            $cache = null;
        }

        if ($debug) {
            CacheDebugger::track('misses', $initDir, $basedir, $key, $cache);
        }

        return $cache;
    }