Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\HttpKernel\HttpCache; Chris@0: Chris@0: use Symfony\Component\HttpFoundation\Request; Chris@0: use Symfony\Component\HttpFoundation\Response; Chris@0: Chris@0: interface SurrogateInterface Chris@0: { Chris@0: /** Chris@0: * Returns surrogate name. Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getName(); Chris@0: Chris@0: /** Chris@0: * Returns a new cache strategy instance. Chris@0: * Chris@0: * @return ResponseCacheStrategyInterface A ResponseCacheStrategyInterface instance Chris@0: */ Chris@0: public function createCacheStrategy(); Chris@0: Chris@0: /** Chris@0: * Checks that at least one surrogate has Surrogate capability. Chris@0: * Chris@0: * @return bool true if one surrogate has Surrogate capability, false otherwise Chris@0: */ Chris@0: public function hasSurrogateCapability(Request $request); Chris@0: Chris@0: /** Chris@0: * Adds Surrogate-capability to the given Request. Chris@0: */ Chris@0: public function addSurrogateCapability(Request $request); Chris@0: Chris@0: /** Chris@0: * Adds HTTP headers to specify that the Response needs to be parsed for Surrogate. Chris@0: * Chris@0: * This method only adds an Surrogate HTTP header if the Response has some Surrogate tags. Chris@0: */ Chris@0: public function addSurrogateControl(Response $response); Chris@0: Chris@0: /** Chris@0: * Checks that the Response needs to be parsed for Surrogate tags. Chris@0: * Chris@0: * @return bool true if the Response needs to be parsed, false otherwise Chris@0: */ Chris@0: public function needsParsing(Response $response); Chris@0: Chris@0: /** Chris@0: * Renders a Surrogate tag. Chris@0: * Chris@0: * @param string $uri A URI Chris@0: * @param string $alt An alternate URI Chris@0: * @param bool $ignoreErrors Whether to ignore errors or not Chris@0: * @param string $comment A comment to add as an esi:include tag Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function renderIncludeTag($uri, $alt = null, $ignoreErrors = true, $comment = ''); Chris@0: Chris@0: /** Chris@0: * Replaces a Response Surrogate tags with the included resource content. Chris@0: * Chris@0: * @return Response Chris@0: */ Chris@0: public function process(Request $request, Response $response); Chris@0: Chris@0: /** Chris@0: * Handles a Surrogate from the cache. Chris@0: * Chris@0: * @param HttpCache $cache An HttpCache instance Chris@0: * @param string $uri The main URI Chris@0: * @param string $alt An alternative URI Chris@0: * @param bool $ignoreErrors Whether to ignore errors or not Chris@0: * Chris@0: * @return string Chris@0: * Chris@0: * @throws \RuntimeException Chris@0: * @throws \Exception Chris@0: */ Chris@0: public function handle(HttpCache $cache, $uri, $alt, $ignoreErrors); Chris@0: }