From: <gem...@li...> - 2011-11-18 09:35:01
|
Revision: 233 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=233&view=rev Author: mennodekker Date: 2011-11-18 09:34:55 +0000 (Fri, 18 Nov 2011) Log Message: ----------- Minor improvement for file cache Invalidate cache when patches have been executed Modified Paths: -------------- trunk/library/classes/Gems/Default/DatabaseAction.php trunk/library/classes/Gems/Upgrades.php trunk/library/classes/Gems/UpgradesAbstract.php trunk/library/classes/GemsEscort.php Modified: trunk/library/classes/Gems/Default/DatabaseAction.php =================================================================== --- trunk/library/classes/Gems/Default/DatabaseAction.php 2011-11-18 09:11:12 UTC (rev 232) +++ trunk/library/classes/Gems/Default/DatabaseAction.php 2011-11-18 09:34:55 UTC (rev 233) @@ -352,6 +352,14 @@ $form->getElement('db_level')->setValue($data['db_level']); $this->addMessage(sprintf($this->_('%d patch(es) executed.'), $changed)); + + //As a lot of cache depends on the database, it is best to clean the cache now + //since import tables might have changed + $cache = $this->escort->cache; + if ($cache instanceof Zend_Cache_Core) { + $cache->clean(); + $this->addMessage($this->_('Cache cleaned')); + } } $tableSql = sprintf( Modified: trunk/library/classes/Gems/Upgrades.php =================================================================== --- trunk/library/classes/Gems/Upgrades.php 2011-11-18 09:11:12 UTC (rev 232) +++ trunk/library/classes/Gems/Upgrades.php 2011-11-18 09:34:55 UTC (rev 233) @@ -66,6 +66,9 @@ public function Upgrade143to15() { $this->patcher->executePatch(42); + + $this->invalidateCache(); + return true; } } \ No newline at end of file Modified: trunk/library/classes/Gems/UpgradesAbstract.php =================================================================== --- trunk/library/classes/Gems/UpgradesAbstract.php 2011-11-18 09:11:12 UTC (rev 232) +++ trunk/library/classes/Gems/UpgradesAbstract.php 2011-11-18 09:34:55 UTC (rev 233) @@ -326,6 +326,19 @@ } /** + * Convenience method for cleaning the cache as this is often needed during + * upgrades + */ + public function invalidateCache() + { + $cache = $this->escort->cache; + if ($cache instanceof Zend_Cache_Core) { + $cache->clean(); + $this->addMessage($this->_('Cache cleaned')); + } + } + + /** * Register an upgrade in the stack, it can be executed by using $this->execute * * Index and context are optional and will be generated when omitted. For the Modified: trunk/library/classes/GemsEscort.php =================================================================== --- trunk/library/classes/GemsEscort.php 2011-11-18 09:11:12 UTC (rev 232) +++ trunk/library/classes/GemsEscort.php 2011-11-18 09:34:55 UTC (rev 233) @@ -169,8 +169,14 @@ } if ($exists) { + /** + * automatic_cleaning_factor disables automatic cleaning of the cache and should get rid of + * random delays on heavy traffic sites with File cache. Apc does + * not support automatic cleaning. + */ $cacheFrontendOptions = array('automatic_serialization' => true, - 'cache_id_prefix' => GEMS_PROJECT_NAME . '_'); + 'cache_id_prefix' => GEMS_PROJECT_NAME . '_', + 'automatic_cleaning_factor' => 0); $cache = Zend_Cache::factory('Core', $cacheBackend, $cacheFrontendOptions, $cacheBackendOptions); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |