/** * Constructor. * * @access protected */ protected function __construct() { // Set current time static::$now = time(); // Cache key allows us to invalidate all cache on configuration changes. static::$key = (Config::get('system.cache.prefix') ? Config::get('system.cache.prefix') : 'fansoro') . '-' . md5(ROOT_DIR . Fansoro::VERSION); // Get Cache Driver static::$driver = static::getCacheDriver(); // Set the cache namespace to our unique key static::$driver->setNamespace(static::$key); }
/** * Constructor * * @param string $path Path to storage directory */ public function __construct($path = 'cache://rememberme') { /** @var Cache $cache */ $cache = self::getGrav()['cache']; $this->cache_dir = self::getGrav()['locator']->findResource($path, true, true); // Setup cache $this->driver = $cache->getCacheDriver(); if ($this->driver instanceof FilesystemCache) { $this->driver = new FilesystemCache($this->cache_dir); } // Set the cache namespace to our unique key $this->driver->setNamespace($cache->getKey()); }