With Symfony 3, the AppKernel allows us to define the cache directory with AppKernel::getCacheDir() method.
I would like to configure the cache directory from a parameter :

```
#app/config/parameters.yml
parameters:
    cache_dir: /var/cache/symfony/

```

And implement the AppKernel::getCacheDir() method :

```
#app/AppKernel.php
class AppKernel extends Kernel
{
    public function getCacheDir()
    {
        return $this->getContainer()->getParameter('cache_dir');
    }

```

The problem is that the Kernel is not booted when the getCacheDir() method is called the first time.

[![Call to a member function getParameter() on null](https://i.stack.imgur.com/d2eNC.png)](https://i.stack.imgur.com/d2eNC.png)

How can I do it ?