コード例 #1
0
ファイル: Module.php プロジェクト: esase/dream-cms
 /**
  * Init
  *
  * @param \Zend\ModuleManager\ModuleManagerInterface $moduleManager
  * @return void
  */
 public function init(ModuleManagerInterface $moduleManager)
 {
     // get service manager
     $this->serviceLocator = $moduleManager->getEvent()->getParam('ServiceManager');
     // clear cache
     $eventManager = AclEvent::getEventManager();
     $eventManager->attach(AclEvent::DELETE_ROLE, function () {
         PageCacheUtility::clearPageCache();
     });
     // clear cache
     $eventManager = LocalizationEvent::getEventManager();
     $eventManager->attach(LocalizationEvent::UNINSTALL, function () {
         PageCacheUtility::clearPageCache();
     });
 }
コード例 #2
0
 /**
  * Clear caches
  *
  * @param array $caches
  *      boolean setting optional
  *      boolean time_zone optional
  *      boolean admin_menu optional
  *      boolean js_cache optional
  *      boolean css_cache optional
  *      boolean layout optional
  *      boolean localization optional
  *      boolean page optional
  *      boolean user optional
  *      boolean xmlrpc optional
  * @return void
  */
 protected function clearCaches(array $caches = [])
 {
     // clear the modules and system config caches
     ApplicationCacheUtility::clearModuleCache();
     ApplicationCacheUtility::clearConfigCache();
     ApplicationCacheUtility::clearDynamicCache();
     foreach ($caches as $cacheName => $clear) {
         if (false === (bool) $clear) {
             continue;
         }
         switch ($cacheName) {
             case 'setting':
                 ApplicationCacheUtility::clearSettingCache();
                 break;
             case 'time_zone':
                 ApplicationCacheUtility::clearTimeZoneCache();
                 break;
             case 'admin_menu':
                 ApplicationCacheUtility::clearAdminMenuCache();
                 break;
             case 'js_cache':
                 ApplicationCacheUtility::clearJsCache();
                 break;
             case 'css_cache':
                 ApplicationCacheUtility::clearCssCache();
                 break;
             case 'layout':
                 LayoutCacheUtility::clearLayoutCache();
                 break;
             case 'localization':
                 LocalizationCacheUtility::clearLocalizationCache();
                 break;
             case 'page':
                 PageCacheUtility::clearPageCache();
                 break;
             case 'user':
                 UserCacheUtility::clearUserCache();
                 break;
             case 'xmlrpc':
                 XmlRpcCacheUtility::clearXmlRpcCache();
                 break;
         }
     }
 }