Storing Symfony 2 cache elsewere?
caching, symfony
Solution
You can only move it outside of the project directory by overloading getCacheDir() method in the AppKernel class.
What's the point of moving it to Memcache? Contents of this directory is most of the time "compiled" classes and templates. Those files are put into memory anyway (APC does that).
Edit: On development, it's harder to avoid I/O, but you can easily move Symfony's cache dir to memory by overriding AppKernel's `getCacheDir()` and `getLogDir()` methods to point them to `/dev/shm`:
class AppKernel extends Kernel
{
// ...
public function getCacheDir()
{
if (in_array($this->environment, array('dev', 'test'))) {
return '/dev/shm/appname/cache/' . $this->environment;
}
return parent::getCacheDir();
}
public function getLogDir()
{
if (in_array($this->environment, array('dev', 'test'))) {
return '/dev/shm/appname/logs';
}
return parent::getLogDir();
}
}
Source: http://www.whitewashing.de/2013/08/19/speedup_symfony2_on_vagrant_boxes.html
Problem
Is there a way to store symfony 2 cache (app/cache) somewhere else other than the filesystem? Memcache, S3, or something? Any built-in option?