15 private const OPTION_APP_IMMUNE_LIST =
'app_immune';
16 private const MODULE_ID =
'rest';
17 private const CACHE_TTL_TIMEOUT = 120;
18 private const CACHE_DIR =
'/rest/';
19 private static $immuneAppList;
26 if (!is_array(static::$immuneAppList))
28 static::$immuneAppList = [];
31 $option = Option::get(static::MODULE_ID, static::OPTION_APP_IMMUNE_LIST,
null);
35 $option = static::getExternal();
40 static::$immuneAppList = Json::decode($option);
44 static::$immuneAppList = [];
47 catch (\Exception $exception)
49 static::$immuneAppList = [];
53 return static::$immuneAppList;
56 private static function getExternal()
59 $cache = Cache::createInstance();
60 if ($cache->initCache(static::CACHE_TTL_TIMEOUT,
'immuneLoadsRepeatingTimeout', static::CACHE_DIR))
62 $result = $cache->getVars();
64 elseif ($cache->startDataCache())
67 if (!empty($res[
'ITEMS']))
69 $result = Json::encode($res[
'ITEMS']);
70 Option::set(static::MODULE_ID, static::OPTION_APP_IMMUNE_LIST, $result);
73 $cache->endDataCache($result);
83 public static function load() : string
85 static::getExternal();
87 return '\Bitrix\Rest\Marketplace\Immune::load();';