From: <gem...@li...> - 2011-11-15 15:35:33
|
Revision: 221 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=221&view=rev Author: mennodekker Date: 2011-11-15 15:35:22 +0000 (Tue, 15 Nov 2011) Log Message: ----------- On update organization, the cache is invalidated Modified Paths: -------------- trunk/library/classes/Gems/Default/OrganizationAction.php trunk/library/classes/Gems/User/Organization.php Modified: trunk/library/classes/Gems/Default/OrganizationAction.php =================================================================== --- trunk/library/classes/Gems/Default/OrganizationAction.php 2011-11-15 14:28:47 UTC (rev 220) +++ trunk/library/classes/Gems/Default/OrganizationAction.php 2011-11-15 15:35:22 UTC (rev 221) @@ -43,6 +43,13 @@ { public $autoFilter = false; + public function afterSave(array $data, $isNew) + { + $org = $this->loader->getOrganization($data['gor_id_organization']); + $org->invalidateCache(); + return parent::afterSave($data, $isNew); + } + public function changeUiAction() { $request = $this->getRequest(); Modified: trunk/library/classes/Gems/User/Organization.php =================================================================== --- trunk/library/classes/Gems/User/Organization.php 2011-11-15 14:28:47 UTC (rev 220) +++ trunk/library/classes/Gems/User/Organization.php 2011-11-15 15:35:22 UTC (rev 221) @@ -116,6 +116,15 @@ } /** + * Get the cacheId for the organization + * + * @return string + */ + private function _getCacheId() { + return GEMS_PROJECT_NAME . '__' . __CLASS__ . '__' . $this->_organizationId; + } + + /** * Should be called after answering the request to allow the Target * to check if all required registry values have been set correctly. * @@ -124,7 +133,7 @@ public function checkRegistryRequestsAnswers() { if ($this->cache) { - $cacheId = GEMS_PROJECT_NAME . '__' . __CLASS__ . '__' . $this->_organizationId; + $cacheId = $this->_getCacheId(); $this->_organizationData = $this->cache->load($cacheId); } else { $cacheId = false; @@ -155,4 +164,11 @@ { return $this->_organizationData['gor_style']; } + + public function invalidateCache() { + if ($this->cache) { + $cacheId = $this->_getCacheId(); + $this->cache->remove($cacheId); + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |