8000 [FrameworkBundle] made the Esi and Store instances configurable in Ht… · cbaudoux/symfony@70df8d3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 70df8d3

Browse files
committed
[FrameworkBundle] made the Esi and Store instances configurable in HttpCache base class
1 parent 0956be9 commit 70df8d3

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
*/
2626
abstract class HttpCache extends BaseHttpCache
2727
{
28+
protected $cacheDir;
29+
protected $kernel;
30+
2831
/**
2932
* Constructor.
3033
*
@@ -33,10 +36,10 @@ abstract class HttpCache extends BaseHttpCache
3336
*/
3437
public function __construct(HttpKernelInterface $kernel, $cacheDir = null)
3538
{
36-
$store = new Store($cacheDir ?: $kernel->getCacheDir().'/http_cache');
37-
$esi = new Esi();
39+
$this->kernel = $kernel;
40+
$this->cacheDir = $cacheDir;
3841

39-
parent::__construct($kernel, $store, $esi, array_merge(array('debug' => $kernel->isDebug()), $this->getOptions()));
42+
parent::__construct($kernel, $this->getStore(), $this->getEsi(), array_merge(array('debug' => $kernel->isDebug()), $this->getOptions()));
4043
}
4144

4245
/**
@@ -66,4 +69,14 @@ protected function getOptions()
6669
{
6770
return array();
6871
}
72+
73+
protected function getEsi()
74+
{
75+
return new Esi();
76+
}
77+
78+
protected function getStore()
79+
{
80+
return new Store($this->cacheDir ?: $this->kernel->getCacheDir().'/http_cache');
81+
}
6982
}

0 commit comments

Comments
 (0)
0