Symfony2 API
Class

Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache

abstract class HttpCache extends HttpCache

Manages HTTP cache objects in a Container.

Methods

__construct(HttpKernelInterface $kernel, string $cacheDir = null)

Constructor.

StoreInterface getStore()

Gets the current store.

from HttpCache
array getTraces()

Returns an array of events that took place during processing of the last request.

from HttpCache
string getLog()

Returns a log message for the events of the last request processing.

from HttpCache
Request getRequest()

Gets the Request instance associated with the master request.

from HttpCache
HttpKernelInterface getKernel()

Gets the Kernel instance

from HttpCache
Esi getEsi()

Gets the Esi instance

from HttpCache
Response handle(Request $request, integer $type = HttpKernelInterface::MASTER_REQUEST, Boolean $catch = true)

Handles a Request to convert it to a Response.

from HttpCache
terminate(Request $request, Response $response)

Terminates a request/response cycle.

from HttpCache

Details

at line 37
public __construct(HttpKernelInterface $kernel, string $cacheDir = null)

Constructor.

The available options are:

* debug: If true, the traces are added as a HTTP header to ease debugging

* default_ttl The number of seconds that a cache entry should be considered
fresh when no explicit freshness information is provided in
a response. Explicit Cache-Control or Expires headers
override this value. (default: 0)

* private_headers Set of request headers that trigger "private" cache-control behavior
on responses that don't explicitly state whether the response is
public or private via a Cache-Control directive. (default: Authorization and Cookie)

* allow_reload Specifies whether the client can force a cache reload by including a
Cache-Control "no-cache" directive in the request. Set it to ``true``
for compliance with RFC 2616. (default: false)

* allow_revalidate Specifies whether the client can force a cache revalidate by including
a Cache-Control "max-age=0" directive in the request. Set it to ``true``
for compliance with RFC 2616. (default: false)

* stale_while_revalidate Specifies the default number of seconds (the granularity is the second as the
Response TTL precision is a second) during which the cache can immediately return
a stale response while it revalidates it in the background (default: 2).
This setting is overridden by the stale-while-revalidate HTTP Cache-Control
extension (see RFC 5861).

* stale_if_error Specifies the default number of seconds (the granularity is the second) during which
the cache can serve a stale response when an error is encountered (default: 60).
This setting is overridden by the stale-if-error HTTP Cache-Control extension
(see RFC 5861).

Parameters

HttpKernelInterface $kernel An HttpKernelInterface instance
string $cacheDir The cache directory (default used if null)

in HttpCache at line 105
public StoreInterface getStore()

Gets the current store.

Return Value

StoreInterface $store A StoreInterface instance

in HttpCache at line 115
public array getTraces()

Returns an array of events that took place during processing of the last request.

Return Value

array An array of events

in HttpCache at line 125
public string getLog()

Returns a log message for the events of the last request processing.

Return Value

string A log message

in HttpCache at line 140
public Request getRequest()

Gets the Request instance associated with the master request.

Return Value

Request A Request instance

in HttpCache at line 150
public HttpKernelInterface getKernel()

Gets the Kernel instance

Return Value

HttpKernelInterface An HttpKernelInterface instance

in HttpCache at line 161
public Esi getEsi()

Gets the Esi instance

Return Value

Esi An Esi instance

in HttpCache at line 171
public Response handle(Request $request, integer $type = HttpKernelInterface::MASTER_REQUEST, Boolean $catch = true)

Handles a Request to convert it to a Response.

When $catch is true, the implementation must catch all exceptions
and do its best to convert them to a Response instance.

Parameters

Request $request A Request instance
integer $type The type of the request (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST)
Boolean $catch Whether to catch exceptions or not

Return Value

Response A Response instance

Exceptions

Exception When an Exception occurs during processing

in HttpCache at line 224
public terminate(Request $request, Response $response)

Terminates a request/response cycle.

Should be called after sending the response and before shutting down the kernel.

Parameters

Request $request A Request instance
Response $response A Response instance