コード例 #1
0
ファイル: Data.php プロジェクト: tingyeeh/magento2
 /**
  * Initialise data for configuration
  * @return void
  */
 protected function initData()
 {
     $data = $this->cache->load($this->cacheId);
     if (false === $data) {
         $data = $this->reader->read();
         $this->cache->save(serialize($data), $this->cacheId, $this->cacheTags);
     } else {
         $data = unserialize($data);
     }
     $this->merge($data);
 }
コード例 #2
0
 /**
  * Create autodisovery structure
  * Param use $string "%s_id" to access $name . "_id" column in $row->$name
  * @param \PDO $connection
  * @param CacheInterface $cache
  * @param string $foreign
  */
 public function __construct(\PDO $connection, CacheInterface $cache = null, $foreign = '%s')
 {
     $this->connection = $connection;
     $this->cache = $cache;
     $this->foreign = $foreign;
     if ($cache) {
         $this->structure = $cache->load("structure");
     }
 }