Permalink
Browse files

Added support for a prefixed Ephemeral handler using a boolean config…

…uration switch.
  • Loading branch information...
1 parent 5051e86 commit b91b4d021d9135132cc0d9bceb118a235dd6d9a7 @jhallbachner committed Sep 30, 2012
@@ -54,9 +54,12 @@ public function collect(Request $request, Response $response, \Exception $except
$handlers = Handlers::getHandlers();
foreach($handlers as $handler) {
$pieces = explode('\\', $handler);
- $info['availableHandlers'][] = array_pop($pieces);
+ $name = array_pop($pieces);
+ if(!in_array($name, array('Ephemeral', 'MultiHandler'))) {
+ $info['availableHandlers'][] = $name;
+ }
}
- $info['availableHandlers'] = $info['availableHandlers'];
+
$info['default'] = $this->defaultCache;
$this->data = $info;
@@ -99,6 +99,7 @@ protected function getCachesNode()
->end()
->end()
->booleanNode('registerDoctrineAdapter')->defaultFalse()->end()
+ ->booleanNode('inMemory')->defaultTrue()->end()
;
foreach($handlers as $handler) {
@@ -48,6 +48,11 @@ protected function addCacheService($name, $cache, $container)
$handlers = $cache['handlers'];
unset($cache['handlers']);
+ if(isset($cache['inMemory']) && $cache['inMemory']) {
+ array_unshift($handlers, 'Ephemeral');
+ }
+ unset($cache['inMemory']);
+
$doctrine = $cache['registerDoctrineAdapter'];
unset($cache['registerDoctrineAdapter']);
@@ -22,6 +22,8 @@ static function createHandler($types, $options)
}
$class = $handlers['MultiHandler'];
- return new $class(array('handlers' => $h));
+ $handler = new $class(array('handlers' => $h));
+
+ return $handler;
}
}
@@ -74,6 +74,14 @@
<th>Hits</th>
<td>{{ details.hits }}</td>
</tr>
+ <tr>
+ <th>Doctrine Adapter</th>
+ <td>{{ details.options.registerDoctrineAdapter ? 'true' : 'false' }}</td>
+ </tr>
+ <tr>
+ <th>Cache In-Memory</th>
+ <td>{{ details.options.inMemory ? 'true' : 'false' }}</td>
+ </tr>
</table>
<h3>Handler Options</h3>

0 comments on commit b91b4d0

Please sign in to comment.