コード例 #1
0
ファイル: Manager.php プロジェクト: vgrish/dvelum
 /**
  * Reset cache
  */
 public function resetCache()
 {
     if (!$this->_cache) {
         return;
     }
     $this->_cache->remove(self::CACHE_KEY_LIST);
     $this->_cache->remove(self::CACHE_KEY_DATA_HASH);
 }
コード例 #2
0
ファイル: Blockmanager.php プロジェクト: vgrish/dvelum
 /**
  * @param array $blockItems
  */
 protected function _invalidateBlockList(array $blockItems)
 {
     if (!$this->_cache) {
         return;
     }
     if (empty($blockItems)) {
         return;
     }
     $blockIds = Utils::fetchCol('id', $blockItems);
     $blockMapping = Model::factory('Blockmapping');
     $pageBlocks = $blockMapping->getList(false, array('block_id' => $blockIds), array('page_id', 'block_id'));
     if (empty($pageBlocks)) {
         return;
     }
     /*
      * Reset block config for pages
      */
     $pages = array_unique(Utils::fetchCol('page_id', $pageBlocks));
     foreach ($pages as $id) {
         if ($id == 0 || empty($id)) {
             $this->invalidateDefaultMap();
         }
         $this->_cache->remove($this->hashPage($id));
         $this->_cache->remove($this->_hashMap($id));
     }
     unset($pages);
     $sortedPageBlocks = Utils::groupByKey('block_id', $pageBlocks);
     $pagesModel = Model::factory('Page');
     $defaultMapped = $pagesModel->getPagesWithDefaultMap();
     /*
      * Reset cache for all blocks with current menu on all pages
      */
     foreach ($blockItems as $v) {
         if (!strlen($v['sys_name'])) {
             $this->_cache->remove($this->getCacheKey(self::DEFAULT_BLOCK, $v));
             continue;
         }
         if (!isset($sortedPageBlocks[$v['id']]) || empty($sortedPageBlocks[$v['id']])) {
             continue;
         }
         foreach ($sortedPageBlocks[$v['id']] as $pageToBlock) {
             if ($v['sys_name']::dependsOnPage) {
                 $v['page_id'] = $pageToBlock['page_id'];
                 if ($v['page_id'] == 0) {
                     foreach ($defaultMapped as $pId) {
                         $cfg = $v;
                         $cfg['page_id'] = $pId;
                         $this->_cache->remove($this->getCacheKey($v['sys_name'], $cfg));
                     }
                 }
             }
             $this->_cache->remove($this->getCacheKey($v['sys_name'], $v));
         }
     }
 }
コード例 #3
0
ファイル: Config.php プロジェクト: vgrish/dvelum
 /**
  * Clear cache
  */
 public static function resetCache()
 {
     if (is_null(self::$_store)) {
         self::_connectStore();
     }
     foreach (self::$_store as $k => $v) {
         if (self::$_cache) {
             self::$_cache->remove($k);
         }
         self::$_store->remove($k);
     }
 }