diff -r 000000000000 -r 7f95f8617b0b vendor/doctrine-common/lib/Doctrine/Common/Cache/ArrayCache.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/doctrine-common/lib/Doctrine/Common/Cache/ArrayCache.php Sat Sep 24 15:40:41 2011 +0200 @@ -0,0 +1,91 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * Array cache driver. + * + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @link www.doctrine-project.org + * @since 2.0 + * @version $Revision: 3938 $ + * @author Benjamin Eberlei + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel + * @author David Abdemoulaie + */ +class ArrayCache extends AbstractCache +{ + /** + * @var array $data + */ + private $data = array(); + + /** + * {@inheritdoc} + */ + public function getIds() + { + return array_keys($this->data); + } + + /** + * {@inheritdoc} + */ + protected function _doFetch($id) + { + if (isset($this->data[$id])) { + return $this->data[$id]; + } + + return false; + } + + /** + * {@inheritdoc} + */ + protected function _doContains($id) + { + return isset($this->data[$id]); + } + + /** + * {@inheritdoc} + */ + protected function _doSave($id, $data, $lifeTime = 0) + { + $this->data[$id] = $data; + + return true; + } + + /** + * {@inheritdoc} + */ + protected function _doDelete($id) + { + unset($this->data[$id]); + + return true; + } +} \ No newline at end of file