__construct() public method

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).
public __construct ( Symfony\Component\HttpKernel\HttpKernelInterface $kernel, Symfony\Component\HttpKernel\HttpCache\StoreInterface $store, Symfony\Component\HttpKernel\HttpCache\SurrogateInterface $surrogate = null, array $options = [] )
$kernel Symfony\Component\HttpKernel\HttpKernelInterface An HttpKernelInterface instance
$store Symfony\Component\HttpKernel\HttpCache\StoreInterface A Store instance
$surrogate Symfony\Component\HttpKernel\HttpCache\SurrogateInterface A SurrogateInterface instance
$options array An array of options
Example #1
0
    /**
     * Constructor.
     *
     * @param HttpKernelInterface $kernel An HttpKernelInterface instance
     */
    public function __construct(HttpKernelInterface $kernel)
    {
        $store = new Store($kernel->getCacheDir().'/http_cache');
        $esi = new Esi();

        parent::__construct($kernel, $store, $esi, array_merge(array('debug' => $kernel->isDebug()), $this->getOptions()));
    }
Example #2
0
 /**
  * Constructor.
  *
  * @param HttpKernelInterface $kernel  An HttpKernelInterface instance
  * @param array               $options
  */
 public function __construct(HttpKernelInterface $kernel, $options)
 {
     $this->kernel = $kernel;
     if (isset($options['cache_dir'])) {
         $this->cacheDir = $options['cache_dir'];
     }
     $this->options = array_merge(array('purge_allowed_ips' => array('127.0.0.1', '::1'), 'debug' => false, 'cache_cookies' => array('shop', 'currency', 'x-cache-context-hash')), $options);
     parent::__construct($kernel, $this->createStore(), $this->createEsi(), $this->options);
 }
Example #3
0
    /**
     * Constructor.
     *
     * @param HttpKernelInterface $kernel An HttpKernelInterface instance
     * @param array $options
     */
    public function __construct(HttpKernelInterface $kernel, $options)
    {
        $this->kernel = $kernel;

        if (isset($options['cache_dir'])) {
            $this->cacheDir = $options['cache_dir'];
        }

        parent::__construct(
            $kernel,
            $this->store = $this->createStore(),
            $this->esi = $this->createEsi(),
            $options
        );
    }
Example #4
0
 /**
  * Constructor.
  *
  * @param HttpKernelInterface $kernel   An HttpKernelInterface instance
  * @param string              $cacheDir The cache directory (default used if null)
  */
 public function __construct(HttpKernelInterface $kernel, $cacheDir = null)
 {
     $this->kernel = $kernel;
     $this->cacheDir = $cacheDir;
     parent::__construct($kernel, $this->createStore(), $this->createEsi(), array_merge(array('debug' => $kernel->isDebug()), $this->getOptions()));
 }
Example #5
0
 public function __construct(HttpKernelInterface $kernel, $options = array())
 {
     parent::__construct($kernel, new Store($kernel->getCacheDir() . '/http_cache'), new Esi(), array_merge(array('debug' => $kernel->isDebug()), $options));
 }