Repository: airavata-php-gateway Updated Branches: refs/heads/airavata-php-gateway-0.15-release e1d623a8b -> 9eb463fb8
property value to disable app-catalog data caching Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/9eb463fb Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/9eb463fb Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/9eb463fb Branch: refs/heads/airavata-php-gateway-0.15-release Commit: 9eb463fb8dcb17e88d40a6879998b6256cc9a159 Parents: e1d623a Author: Supun Nakandala <[email protected]> Authored: Thu Jun 18 16:33:37 2015 +0530 Committer: Supun Nakandala <[email protected]> Committed: Thu Jun 18 16:36:47 2015 +0530 ---------------------------------------------------------------------- app/config/pga_config.php.template | 5 +++++ app/libraries/AppUtilities.php | 13 +++++++++---- app/libraries/CRUtilities.php | 13 +++++++++---- 3 files changed, 23 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9eb463fb/app/config/pga_config.php.template ---------------------------------------------------------------------- diff --git a/app/config/pga_config.php.template b/app/config/pga_config.php.template index 27ec861..2807fa9 100644 --- a/app/config/pga_config.php.template +++ b/app/config/pga_config.php.template @@ -127,6 +127,11 @@ return array( 'wall-time-limit' => '30', /** + * Enable app-catalog cache + */ + 'enable-app-catalog-cache' => true, + + /** * Life time of app catalog data cache in minutes */ 'app-catalog-cache-duration' => 5 http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9eb463fb/app/libraries/AppUtilities.php ---------------------------------------------------------------------- diff --git a/app/libraries/AppUtilities.php b/app/libraries/AppUtilities.php index 96e3f30..6a01509 100644 --- a/app/libraries/AppUtilities.php +++ b/app/libraries/AppUtilities.php @@ -243,14 +243,19 @@ class AppUtilities $applicationInterface = null; try { - if (Cache::has('APP-' . $id)) { - return Cache::get('APP-' . $id); + if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) { + if (Cache::has('APP-' . $id)) { + return Cache::get('APP-' . $id); + } else { + $applicationInterface = Airavata::getApplicationInterface($id); + Cache::put('APP-' . $id, $applicationInterface, Config::get('pga_config.airavata')['app-catalog-cache-duration']); + return $applicationInterface; + } } else { $applicationInterface = Airavata::getApplicationInterface($id); - Cache::put('APP-' . $id, $applicationInterface, Config::get('pga_config.airavata')['app-catalog-cache-duration']); - return $applicationInterface; } + } catch (InvalidRequestException $ire) { CommonUtilities::print_error_message('<p>There was a problem getting the application interface. Please try again later or submit a bug report using the link in the Help menu.</p>' . http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9eb463fb/app/libraries/CRUtilities.php ---------------------------------------------------------------------- diff --git a/app/libraries/CRUtilities.php b/app/libraries/CRUtilities.php index 9e3069d..97723cb 100755 --- a/app/libraries/CRUtilities.php +++ b/app/libraries/CRUtilities.php @@ -420,13 +420,18 @@ class CRUtilities $computeResource = null; try { - if (Cache::has('CR-' . $id)) { - return Cache::get('CR-' . $id); + if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) { + if (Cache::has('CR-' . $id)) { + return Cache::get('CR-' . $id); + } else { + $computeResource = Airavata::getComputeResource($id); + Cache::put('CR-' . $id, $computeResource, Config::get('pga_config.airavata')['app-catalog-cache-duration']); + return $computeResource; + } } else { $computeResource = Airavata::getComputeResource($id); - Cache::put('CR-' . $id, $computeResource, Config::get('pga_config.airavata')['app-catalog-cache-duration']); - return $computeResource; } + } catch (InvalidRequestException $ire) { CommonUtilities::print_error_message('<p>There was a problem getting the compute resource. Please try again later or submit a bug report using the link in the Help menu.</p>' .
