code: public function checkCache()
      {
          $options = $this->options;
  
          $configDir = Application::getConfigDir();
  
          $cacheDir = $options->getCacheDir();
  
          if (!is_dir($cacheDir)) {
              mkdir($cacheDir, 0777, true);
          }
  
          $mtimes = [];
          $mtimes[] = filemtime($configDir.'/config.php');
  
          foreach ($options->getConfigGlobPaths() as $path) {
              foreach (Glob::glob($path, Glob::GLOB_BRACE) as $file) {
                  $mtimes[] = filemtime($file);
              }
          }
  
          $checksum = md5(serialize($mtimes));
  
          $checksumFile = $options->getCacheDir().'/.checksum';
          if (!file_exists($checksumFile)) {
              touch($checksumFile);
          }
          if (is_readable($checksumFile)) {
              $cacheSum = file_get_contents($checksumFile);
              if ($cacheSum != $checksum) {
                  $this->clearCache();
                  file_put_contents($checksumFile, $checksum, LOCK_EX);
              }
          } else {
              $this->log("Can\'t process cache .checksum file is not readable.");
          }
      }
docs: This function will check cache by creating md5 sum
  from all file modification time in config/autoload/*.php.
  If checksum is invalid it will automatically call clear cache.