original_string: public function init(Grav $grav)
      {
          /** @var Config $config */
          $this->config = $grav['config'];
          $this->now = time();
  
          if (null === $this->enabled) {
              $this->enabled = (bool)$this->config->get('system.cache.enabled');
          }
  
          /** @var Uri $uri */
          $uri = $grav['uri'];
  
          $prefix = $this->config->get('system.cache.prefix');
          $uniqueness = substr(md5($uri->rootUrl(true) . $this->config->key() . GRAV_VERSION), 2, 8);
  
          // Cache key allows us to invalidate all cache on configuration changes.
          $this->key = ($prefix ? $prefix : 'g') . '-' . $uniqueness;
          $this->cache_dir = $grav['locator']->findResource('cache://doctrine/' . $uniqueness, true, true);
          $this->driver_setting = $this->config->get('system.cache.driver');
          $this->driver = $this->getCacheDriver();
          $this->driver->setNamespace($this->key);
  
          /** @var EventDispatcher $dispatcher */
          $dispatcher = Grav::instance()['events'];
          $dispatcher->addListener('onSchedulerInitialized', [$this, 'onSchedulerInitialized']);
      }
code: public function init(Grav $grav)
      {
          /** @var Config $config */
          $this->config = $grav['config'];
          $this->now = time();
  
          if (null === $this->enabled) {
              $this->enabled = (bool)$this->config->get('system.cache.enabled');
          }
  
          /** @var Uri $uri */
          $uri = $grav['uri'];
  
          $prefix = $this->config->get('system.cache.prefix');
          $uniqueness = substr(md5($uri->rootUrl(true) . $this->config->key() . GRAV_VERSION), 2, 8);
  
          // Cache key allows us to invalidate all cache on configuration changes.
          $this->key = ($prefix ? $prefix : 'g') . '-' . $uniqueness;
          $this->cache_dir = $grav['locator']->findResource('cache://doctrine/' . $uniqueness, true, true);
          $this->driver_setting = $this->config->get('system.cache.driver');
          $this->driver = $this->getCacheDriver();
          $this->driver->setNamespace($this->key);
  
          /** @var EventDispatcher $dispatcher */
          $dispatcher = Grav::instance()['events'];
          $dispatcher->addListener('onSchedulerInitialized', [$this, 'onSchedulerInitialized']);
      }
code_tokens: public function init ( Grav $ grav ) { /** @var Config $config */ $ this -> config = $ grav [ 'config' ] ; $ this -> now = time ( ) ; if ( null === $ this -> enabled ) { $ this -> enabled = ( bool ) $ this -> config -> get ( 'system.cache.enabled' ) ; } /** @var Uri $uri */ $ uri = $ grav [ 'uri' ] ; $ prefix = $ this -> config -> get ( 'system.cache.prefix' ) ; $ uniqueness = substr ( md5 ( $ uri -> rootUrl ( true ) . $ this -> config -> key ( ) . GRAV_VERSION ) , 2 , 8 ) ; // Cache key allows us to invalidate all cache on configuration changes. $ this -> key = ( $ prefix ? $ prefix : 'g' ) . '-' . $ uniqueness ; $ this -> cache_dir = $ grav [ 'locator' ] -> findResource ( 'cache://doctrine/' . $ uniqueness , true , true ) ; $ this -> driver_setting = $ this -> config -> get ( 'system.cache.driver' ) ; $ this -> driver = $ this -> getCacheDriver ( ) ; $ this -> driver -> setNamespace ( $ this -> key ) ; /** @var EventDispatcher $dispatcher */ $ dispatcher = Grav :: instance ( ) [ 'events' ] ; $ dispatcher -> addListener ( 'onSchedulerInitialized' , [ $ this , 'onSchedulerInitialized' ] ) ; }
docstring: Initialization that sets a base key and the driver based on configuration settings
  
  @param  Grav $grav
  
  @return void
docstring_tokens: Initialization that sets a base key and the driver based on configuration settings