merged branch kbond/extensible-httpcache (PR #3716)

Commits
-------

8f11f2dd shortened if/else syntax
2b8c2bc [FrameworkBundle] made http_cache dir extensible

Discussion
----------

[FrameworkBundle] make http_cache dir extensible

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes

I have a use case where I don't want the httpcache cleared on `cache:clear`.  Currently, it is awkward to change this directory.

[![Build Status](https://secure.travis-ci.org/kbond/symfony.png?branch=extensible-httpcache)](http://travis-ci.org/kbond/symfony)
This commit is contained in:
Fabien Potencier 2012-03-30 08:10:12 +02:00
commit e18fcd852a

View File

@ -28,11 +28,12 @@ abstract class HttpCache extends BaseHttpCache
/**
* Constructor.
*
* @param HttpKernelInterface $kernel An HttpKernelInterface instance
* @param HttpKernelInterface $kernel An HttpKernelInterface instance
* @param String $cacheDir The cache directory (default used if null)
*/
public function __construct(HttpKernelInterface $kernel)
public function __construct(HttpKernelInterface $kernel, $cacheDir = null)
{
$store = new Store($kernel->getCacheDir().'/http_cache');
$store = new Store($cacheDir ?: $kernel->getCacheDir().'/http_cache');
$esi = new Esi();
parent::__construct($kernel, $store, $esi, array_merge(array('debug' => $kernel->isDebug()), $this->getOptions()));