/** * Construct a new cached ConfigIO * * @param zibo\core\environment\Environment $environment the environment currently operating in * @param ConfigIO $configIO the ConfigIO implementation to decorate * @param zibo\library\cache\Cache $cache the Cache to use for caching, omit it to use the default * file based cache at the path application/data/cache/config */ public function __construct(Environment $environment, ConfigIO $configIO, Cache $cache = null) { $this->configIO = $configIO; $this->cacheType = $environment->getName(); $this->cache = $cache; $this->isCacheEnabled = null; }
/** * Construct a new cached ConfigIO * * @param ConfigIO $configIO the ConfigIO implementation to decorate * @param zibo\core\environment\Environment $environment the environment * currently operating in * @param zibo\library\cache\Cache $cache the Cache to use for caching, * omit it to use the default file based cache at the path * application/data/cache/config */ public function __construct(ConfigIO $configIO, Environment $environment, Cache $cache = null) { $this->configIO = $configIO; $this->cacheType = $environment->getName(); $this->cache = $cache; $this->setIsCacheEnabled($this->getConfigValue(self::CONFIG_CACHE_ENABLED, false)); }
/** * Get the path of the environment configuration * @return string */ private function getEnvironmentPath() { if (!$this->environmentPath) { $environmentName = $this->environment->getName(); $writePath = $this->getWritePath(); $this->environmentPath = new File($writePath, $environmentName); } return $this->environmentPath; }