private function write($key, array $data)
    {
        $fname = $this->getObjectPath($key);
        $content = serialize($data);
        $path = dirname($fname);
        if (!file_exists($path) && !mkdir($path, 0755, true)) {
            throw new \RuntimeException('Unable to create directory for cache');
        }
        file_put_contents($fname, $content);
    }