protected function writeMetadata($id, array $metadata)
    {
        $filename = $this->getFilename($id, true);
        $this->assertDirectory($filename);
        $this->assertFile($filename);
        if (false === file_put_contents($filename, serialize($metadata))) {
            throw new RawFileCacheException(sprintf('Cannot write file : %s', $filename), RawFileCacheException::CANNOT_WRITE_FILE);
        }
    }