<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Adapter;
use Doctrine\Common\Cache\CacheProvider;
/**
* @author Nicolas Grekas <p@tchwork.com>
class DoctrineAdapter extends AbstractAdapter
{
private $provider;
public function __construct(CacheProvider $provider, $defaultLifetime = null)
parent::__construct('', $defaultLifetime);
$this->provider = $provider;
}
* {@inheritdoc}
protected function doFetch(array $ids)
return $this->provider->fetchMultiple($ids);
protected function doHave($id)
return $this->provider->contains($id);
protected function doClear($namespace)
return $this->provider->flushAll();
protected function doDelete(array $ids)
$ok = true;
foreach ($ids as $id) {
$ok = $this->provider->delete($id) && $ok;
return $ok;
protected function doSave(array $values, $lifetime)
return $this->provider->saveMultiple($values, $lifetime);