. */ namespace Doctrine\ORM\Cache; /** * Array cache driver. * * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link www.doctrine-project.org * @since 1.0 * @version $Revision: 4910 $ * @author Konsta Vesterinen */ class ArrayCache implements Cache { /** * @var array $data */ private $data; /** * {@inheritdoc} */ public function fetch($id) { if (isset($this->data[$id])) { return $this->data[$id]; } return false; } /** * {@inheritdoc} */ public function contains($id) { return isset($this->data[$id]); } /** * {@inheritdoc} */ public function save($id, $data, $lifeTime = false) { $this->data[$id] = $data; } /** * {@inheritdoc} */ public function delete($id) { unset($this->data[$id]); } /** * {@inheritdoc} */ public function deleteAll() { $this->data = array(); } /** * count * * @return integer */ public function count() { return count($this->data); } }