This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Bundle/FrameworkBundle/Cache/Cache.php

70 lines
2.0 KiB
PHP
Raw Normal View History

2010-06-23 20:42:41 +01:00
<?php
removed Symfony\Framework Things have been moved to Symfony\Component\HttpKernel and Symfony\Bundle\FrameworkBundle The kernel configuration namespace was removed and merged with the main web configuration namespace (kernel:config => web:config, kernel:test => web:test, and kernel:session => web:session): Before: <kernel:config charset="UTF-8" error_handler="null" /> <web:config csrf-secret="xxxxxxxxxx"> <web:router resource="%kernel.root_dir%/config/routing.xml" /> <web:validation enabled="true" annotations="true" /> </web:config> After: <web:config csrf-secret="xxxxxxxxxx" charset="UTF-8" error-handler="null"> <web:router resource="%kernel.root_dir%/config/routing.xml" /> <web:validation enabled="true" annotations="true" /> </web:config> Renamed classes: Symfony\{Framework => Bundle\FrameworkBundle}\Cache\Cache Symfony\{Framework => Bundle\FrameworkBundle}\Client Symfony\{Framework => Bundle\FrameworkBundle}\Debug\EventDispatcher Symfony\{Framework => Bundle\FrameworkBundle}\Debug\EventDispatcherTraceableInterface Symfony\{Framework => Bundle\FrameworkBundle}\EventDispatcher Symfony\{Framework => Component\HttpFoundation}\UniversalClassLoader Symfony\{Framework => Component\HttpKernel}\Bundle\Bundle Symfony\{Framework => Component\HttpKernel}\Bundle\BundleInterface Symfony\{Framework => Component\HttpKernel}\ClassCollectionLoader Symfony\{Framework => Component\HttpKernel}\Debug\ErrorException Symfony\{Framework => Component\HttpKernel}\Debug\ErrorHandler Symfony\{Bundle\FrameworkBundle => Component\HttpKernel}\Debug\ExceptionListener Symfony\{Framework => Component\HttpKernel}\Kernel
2010-09-15 19:49:16 +01:00
namespace Symfony\Bundle\FrameworkBundle\Cache;
2010-06-23 20:42:41 +01:00
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Cache\Cache as BaseCache;
use Symfony\Component\HttpKernel\Cache\Esi;
use Symfony\Component\HttpKernel\Cache\Store;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
2010-06-23 20:42:41 +01:00
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
*
* @author Fabien Potencier <fabien.potencier@symfony-project.org>
2010-06-23 20:42:41 +01:00
*/
abstract class Cache extends BaseCache
{
/**
* Constructor.
*
* @param HttpKernelInterface $kernel An HttpKernelInterface instance
2010-06-23 20:42:41 +01:00
*/
public function __construct(HttpKernelInterface $kernel)
{
$store = new Store($kernel->getCacheDir().'/http_cache');
2010-06-23 20:42:41 +01:00
$esi = new Esi();
parent::__construct($kernel, $store, $esi, array_merge(array('debug' => $kernel->isDebug()), $this->getOptions()));
2010-06-23 20:42:41 +01:00
}
/**
* Forwards the Request to the backend and returns the Response.
*
* @param Requset $request A Request instance
* @param Boolean $raw Whether to catch exceptions or not
* @param Response $response A Response instance (the stale entry if present, null otherwise)
2010-06-23 20:42:41 +01:00
*
* @return Response A Response instance
2010-06-23 20:42:41 +01:00
*/
protected function forward(Request $request, $raw = false, Response $entry = null)
{
if (!$this->kernel->isBooted()) {
$this->kernel->boot();
}
2010-06-27 17:28:29 +01:00
$this->kernel->getContainer()->set('cache', $this);
$this->kernel->getContainer()->set('esi', $this->esi);
2010-06-23 20:42:41 +01:00
return parent::forward($request, $raw, $entry);
}
/**
* Returns an array of options to customize the Cache configuration.
*
* @return array An array of options
*/
protected function getOptions()
{
return array();
}
}