Repository: airavata-php-gateway Updated Branches: refs/heads/master 3993dc3f6 -> 2e8b242b8
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/2e8b242b Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/2e8b242b Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/2e8b242b Branch: refs/heads/master Commit: 2e8b242b812a41c167fad66d26279b4bc1ca9218 Parents: 3993dc3 Author: Supun Nakandala <[email protected]> Authored: Thu Jun 18 16:33:37 2015 +0530 Committer: Supun Nakandala <[email protected]> Committed: Thu Jun 18 16:33:37 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/2e8b242b/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/2e8b242b/app/libraries/AppUtilities.php ---------------------------------------------------------------------- diff --git a/app/libraries/AppUtilities.php b/app/libraries/AppUtilities.php index a789fcf..43a8d90 100644 --- a/app/libraries/AppUtilities.php +++ b/app/libraries/AppUtilities.php @@ -248,14 +248,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/2e8b242b/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>' .
