public function __construct(Connection $connection, $storageName, array $entityPrimaryKey, IStorage $cacheStorage) { $this->connection = $connection; $this->storageName = $storageName; $this->entityPrimaryKey = $entityPrimaryKey; $config = $connection->getConfig(); $key = md5(json_encode($config)); $this->cache = new Cache($cacheStorage, 'Nextras.Orm.db_reflection.' . $key); list($this->mappings, $this->modifiers) = $this->getDefaultMappings(); }
public function __construct(Connection $connection, Cache $cache) { $key = md5(json_encode($connection->getConfig())); $this->connection = $connection; $this->cache = $cache->derive('mapper.' . $key); }