예제 #1
0
파일: Cache.php 프로젝트: cv0/fansoro
 /**
  * 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);
 }
예제 #2
0
 /**
  * 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());
 }