This task is really simple. You can achieve it from Kernel.php, getCacheDir method:
public function getCacheDir() { // return $this->getProjectDir().'/var/cache/'.$this->environment; //Any location on your server return '/dev/shm/'.$this->environment; //This will cache in RAM }