public function cache($request)
    {
        $currentTime = time();
        $entries     = array();

        if ($this->exists($request)) {
            foreach ($this->entries as $entry) {
                if ($entry['expiration'] < $currentTime) {
                    // remove expired entry from the metadata
                    continue;
                }
                if ($entry['sourceFile'] === $request['file']->getPathname()) {
                    // remove old cached content
                    $this->cache->delete($entry['cacheData']);
                } else {
                    $entries[] = $entry;
                }
            }
        }

        // update the manifest
        $key = sha1_file($request['file']->getPathname());
        array_push(
            $entries,
            array(
                'expiration' => $currentTime + $this->maxlifetime,
                'cacheData'  => $key,
                'sourceFile' => $request['file']->getPathname()
            )
        );
        $this->cache->save($this->key, $entries);

        // save user data
        $this->cache->save($key, $request['ast']);
    }