Commit 3f2d55a7 authored by Fabien Potencier's avatar Fabien Potencier

added a run() method to HttpCache to mimic Application

parent e7c74a64
......@@ -40,9 +40,9 @@ setting Response HTTP cache headers::
});
This extension allows you to use the Symfony2 reverse proxy natively with
Silex applications by using the `http_cache` service to handle the Request::
Silex applications by using the `http_cache` service::
$app['http_cache']->handle()->send();
$app['http_cache']->run();
The extension also provide `ESI
<http://www.doctrine-project.org/docs/dbal/2.0/en/>`_ support::
......@@ -69,7 +69,7 @@ The extension also provide `ESI
));
});
$app['http_cache']->handle()->send();
$app['http_cache']->run();
For more information, consult the `Symfony2 HTTP Cache documentation
<http://symfony.com/doc/current/book/http_cache.html>`_.
......@@ -13,7 +13,7 @@ namespace Silex\Extension;
use Silex\Application;
use Silex\ExtensionInterface;
use Symfony\Component\HttpKernel\HttpCache\HttpCache;
use Silex\HttpCache;
use Symfony\Component\HttpKernel\HttpCache\Esi;
use Symfony\Component\HttpKernel\HttpCache\Store;
......
<?php
/*
* This file is part of the Silex framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Silex;
use Symfony\Component\HttpKernel\HttpCache\HttpCache as BaseHttpCache;
use Symfony\Component\HttpFoundation\Request;
/**
* HTTP Cache extension to allow using the run() shortcut.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class HttpCache extends BaseHttpCache
{
public function run(Request $request = null)
{
if (null === $request) {
$request = Request::createFromGlobals();
}
$this->handle($request)->send();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment