class Esi implements SurrogateInterface

Esi implements the ESI capabilities to Request and Response instances.

For more information, read the following W3C notes:

  • ESI Language Specification 1.0 (http://www.w3.org/TR/esi-lang)

  • Edge Architecture Specification (http://www.w3.org/TR/edge-arch)

Methods

__construct(array $contentTypes = array('text/html', 'text/xml', 'application/xhtml+xml', 'application/xml'))

No description

string
getName()

Returns surrogate name.

createCacheStrategy()

Returns a new cache strategy instance.

bool
hasSurrogateCapability(Request $request)

Checks that at least one surrogate has ESI/1.0 capability.

bool
hasSurrogateEsiCapability(Request $request) deprecated

Checks that at least one surrogate has ESI/1.0 capability.

addSurrogateCapability(Request $request)

Adds ESI/1.0 capability to the given Request.

addSurrogateEsiCapability(Request $request) deprecated

Adds ESI/1.0 capability to the given Request.

addSurrogateControl(Response $response)

Adds HTTP headers to specify that the Response needs to be parsed for ESI.

bool
needsParsing(Response $response)

Checks that the Response needs to be parsed for ESI tags.

bool
needsEsiParsing(Response $response) deprecated

Checks that the Response needs to be parsed for ESI tags.

string
renderIncludeTag(string $uri, string $alt = null, bool $ignoreErrors = true, string $comment = '')

Renders an ESI tag.

process(Request $request, Response $response)

Replaces a Response ESI tags with the included resource content.

string
handle(HttpCache $cache, string $uri, string $alt, bool $ignoreErrors)

Handles an ESI from the cache.

Details

at line 41
__construct(array $contentTypes = array('text/html', 'text/xml', 'application/xhtml+xml', 'application/xml'))

Parameters

array $contentTypes An array of content-type that should be parsed for ESI information (default: text/html, text/xml, application/xhtml+xml, and application/xml)

at line 46
string getName()

Returns surrogate name.

Return Value

string

at line 56
ResponseCacheStrategyInterface createCacheStrategy()

Returns a new cache strategy instance.

Return Value

ResponseCacheStrategyInterface A ResponseCacheStrategyInterface instance

at line 66
bool hasSurrogateCapability(Request $request)

Checks that at least one surrogate has ESI/1.0 capability.

Parameters

Request $request

Return Value

bool true if one surrogate has Surrogate capability, false otherwise

at line 84
bool hasSurrogateEsiCapability(Request $request) deprecated

deprecated since version 2.6, to be removed in 3.0. Use hasSurrogateCapability() instead

Checks that at least one surrogate has ESI/1.0 capability.

Parameters

Request $request A Request instance

Return Value

bool true if one surrogate has ESI/1.0 capability, false otherwise

at line 94
addSurrogateCapability(Request $request)

Adds ESI/1.0 capability to the given Request.

Parameters

Request $request

at line 109
addSurrogateEsiCapability(Request $request) deprecated

deprecated since version 2.6, to be removed in 3.0. Use addSurrogateCapability() instead

Adds ESI/1.0 capability to the given Request.

Parameters

Request $request A Request instance

at line 121
addSurrogateControl(Response $response)

Adds HTTP headers to specify that the Response needs to be parsed for ESI.

This method only adds an ESI HTTP header if the Response has some ESI tags.

Parameters

Response $response

at line 133
bool needsParsing(Response $response)

Checks that the Response needs to be parsed for ESI tags.

Parameters

Response $response

Return Value

bool true if the Response needs to be parsed, false otherwise

at line 151
bool needsEsiParsing(Response $response) deprecated

deprecated since version 2.6, to be removed in 3.0. Use needsParsing() instead

Checks that the Response needs to be parsed for ESI tags.

Parameters

Response $response A Response instance

Return Value

bool true if the Response needs to be parsed, false otherwise

at line 168
string renderIncludeTag(string $uri, string $alt = null, bool $ignoreErrors = true, string $comment = '')

Renders an ESI tag.

Parameters

string $uri A URI
string $alt An alternate URI
bool $ignoreErrors Whether to ignore errors or not
string $comment A comment to add as an esi:include tag

Return Value

string

at line 188
Response process(Request $request, Response $response)

Replaces a Response ESI tags with the included resource content.

Parameters

Request $request
Response $response

Return Value

Response

at line 260
string handle(HttpCache $cache, string $uri, string $alt, bool $ignoreErrors)

Handles an ESI from the cache.

Parameters

HttpCache $cache An HttpCache instance
string $uri The main URI
string $alt An alternative URI
bool $ignoreErrors Whether to ignore errors or not

Return Value

string

Exceptions

RuntimeException
Exception