diff --git a/Storage/Doctrine/DoctrineORMStorage.php b/Storage/Doctrine/DoctrineORMStorage.php index 2f1c6e8..843e919 100644 --- a/Storage/Doctrine/DoctrineORMStorage.php +++ b/Storage/Doctrine/DoctrineORMStorage.php @@ -11,6 +11,11 @@ */ class DoctrineORMStorage implements StorageInterface { + /** + * @var array + */ + private $cache = []; + /** * @var \Doctrine\ORM\EntityManagerInterface */ @@ -44,8 +49,17 @@ public function __construct(EntityManagerInterface $em, $class) */ public function get($key) { + if (isset($this->cache[$key])) { + /** @var Feature $feature */ + $feature = $this->cache[$key]; + + return $feature->getSettings(); + } + /** @var Feature $feature */ $feature = $this->repository->findOneBy(array('name' => $key)); + $this->cache[$key] = $feature; + if (!$feature) { return null; }