Skip to content

Instantly share code, notes, and snippets.

@armetiz
Created February 17, 2012 10:24
Show Gist options
  • Save armetiz/1852492 to your computer and use it in GitHub Desktop.
Save armetiz/1852492 to your computer and use it in GitHub Desktop.
Classes cache warmup.
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Acme\BundleTest\CacheWarmer;
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
use Symfony\Component\HttpKernel\Kernel;
/**
* Generates the router matcher and generator classes.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class ClassesWarmer implements CacheWarmerInterface
{
protected $kernel;
/**
* Constructor.
*
* @param Router $router A Router instance
*/
public function __construct(Kernel $kernel)
{
$this->kernel = $kernel;
}
/**
* Warms up the cache.
*
* @param string $cacheDir The cache directory
*/
public function warmUp($cacheDir)
{
$this->kernel->loadClassCache();
}
/**
* Checks whether this warmer is optional or not.
*
* @return Boolean always true
*/
public function isOptional()
{
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment