You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2015/07/14 18:38:30 UTC

[25/40] airavata-php-gateway git commit: invalidating cached app interface and CR values when updating/deleting

invalidating cached app interface and CR values when updating/deleting


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/07664c6c
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/07664c6c
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/07664c6c

Branch: refs/heads/0.15-release-branch
Commit: 07664c6c555ef9796538d55162cbc7e9bcdf8878
Parents: 476a075
Author: Supun Nakandala <sc...@apache.org>
Authored: Tue Jun 30 14:51:53 2015 +0530
Committer: Supun Nakandala <sc...@apache.org>
Committed: Tue Jun 30 14:52:22 2015 +0530

----------------------------------------------------------------------
 app/libraries/AppUtilities.php | 16 +++++++++++++---
 app/libraries/CRUtilities.php  | 11 +++++++++++
 2 files changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/07664c6c/app/libraries/AppUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/AppUtilities.php b/app/libraries/AppUtilities.php
index cc7323f..7134360 100644
--- a/app/libraries/AppUtilities.php
+++ b/app/libraries/AppUtilities.php
@@ -100,16 +100,26 @@ class AppUtilities
 
         //var_dump( $appInterface); exit;
 
-        if ($update)
+        if ($update) {
+            if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
+                if (Cache::has('APP-' . $appInterfaceValues["app-interface-id"])) {
+                    Cache::forget('APP-' . $appInterfaceValues["app-interface-id"]);
+                }
+            }
             Airavata::updateApplicationInterface($appInterfaceValues["app-interface-id"], $appInterface);
-        else
+        } else {
             Airavata::getApplicationInterface(Airavata::registerApplicationInterface(Session::get("gateway_id"), $appInterface));
-
+        }
         //print_r( "App interface has been created.");
     }
 
     public static function deleteAppInterface($appInterfaceId)
     {
+        if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
+            if (Cache::has('APP-' . $appInterfaceId)) {
+                Cache::forget('APP-' . $appInterfaceId);
+            }
+        }
         return Airavata::deleteApplicationInterface($appInterfaceId);
     }
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/07664c6c/app/libraries/CRUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/CRUtilities.php b/app/libraries/CRUtilities.php
index 850c2c8..6e37cc6 100755
--- a/app/libraries/CRUtilities.php
+++ b/app/libraries/CRUtilities.php
@@ -41,6 +41,11 @@ class CRUtilities
     {
         if ($update) {
             $computeResourceId = $computeDescription->computeResourceId;
+            if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
+                if (Cache::has('CR-' . $computeResourceId)) {
+                    Cache::forget('CR-' . $computeResourceId);
+                }
+            }
 
             if (Airavata::updateComputeResource($computeResourceId, $computeDescription)) {
                 $computeResource = Airavata::getComputeResource($computeResourceId);
@@ -407,6 +412,12 @@ class CRUtilities
 
     public static function deleteCR($inputs)
     {
+        if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
+            $id = $inputs["rem-crId"];
+            if (Cache::has('CR-' . $id)) {
+                Cache::forget('CR-' . $id);
+            }
+        }
         return Airavata::deleteGatewayComputeResourcePreference($inputs["gpId"], $inputs["rem-crId"]);
     }