Skip to content

Instantly share code, notes, and snippets.

@pestaa
Created March 30, 2016 14:06
Show Gist options
  • Save pestaa/d544870c8bf7c9ecdc1cb999ac918cbb to your computer and use it in GitHub Desktop.
Save pestaa/d544870c8bf7c9ecdc1cb999ac918cbb to your computer and use it in GitHub Desktop.
Differently warmed Symfony cache with FosHttpCacheBundle
<?php
require_once __DIR__ . "/AppCache.php";
use Symfony\Component\HttpKernel\KernelInterface;
class AppCacheKernelProxy extends AppCache implements KernelInterface
{
/**
* @var KernelInterface
*/
protected $kernel;
public function serialize()
{
return $this->kernel->serialize();
}
public function unserialize($serialized)
{
$this->kernel->unserialize($serialized);
}
public function registerBundles()
{
return $this->kernel->registerBundles();
}
public function registerContainerConfiguration(\Symfony\Component\Config\Loader\LoaderInterface $loader)
{
$this->kernel->registerContainerConfiguration($loader);
}
public function boot()
{
$this->kernel->boot();
}
public function shutdown()
{
$this->kernel->shutdown();
}
public function getBundles()
{
return $this->kernel->getBundles();
}
public function isClassInActiveBundle($class)
{
return $this->kernel->isClassInActiveBundle($class);
}
public function getBundle($name, $first = true)
{
return $this->kernel->getBundle($name, $first);
}
public function locateResource($name, $dir = null, $first = true)
{
return $this->kernel->locateResource($name, $dir, $first);
}
public function getName()
{
return $this->kernel->getName();
}
public function getEnvironment()
{
return $this->kernel->getEnvironment();
}
public function isDebug()
{
return $this->kernel->isDebug();
}
public function getRootDir()
{
return $this->kernel->getRootDir();
}
public function getContainer()
{
return $this->kernel->getContainer();
}
public function getStartTime()
{
return $this->kernel->getStartTime();
}
public function getCacheDir()
{
return $this->kernel->getCacheDir();
}
public function getLogDir()
{
return $this->kernel->getLogDir();
}
public function getCharset()
{
return $this->kernel->getCharset();
}
}
#!/usr/bin/env php
<?php
// ...
require_once __DIR__ . '/AppCacheKernelProxy.php';
$application = new Application(new AppCacheKernelProxy(new AppKernel($env, $debug)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment