Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #180 from rhelmer/2.3.3

2.3.3
  • Loading branch information...
commit 9565bd6ce5951bc8b9f119122cf5ed32d44fd766 2 parents 42d1b22 + e17d6c3
@rhelmer rhelmer authored
Showing with 23 additions and 0 deletions.
  1. +23 −0 webapp-php/application/models/branch.php
View
23 webapp-php/application/models/branch.php
@@ -49,6 +49,22 @@
class Branch_Model extends Model {
protected static $_CACHE = array();
+ protected $_cache_obj;
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->_cache_obj = Cache::instance();
+ $c = $this->_cache_obj->get('branch.cache.objects');
+ if($c) {
+ self::$_CACHE = $c;
+ }
+ }
+
+ public function __destruct()
+ {
+ $this->_cache_obj->set('branch.cache.objects', self::$_CACHE, NULL, 1800);
+ }
protected function _getValues(array $order_by = array(), $ignore_cache = false) {
$order_by = implode(",", $order_by);
@@ -94,6 +110,11 @@ private function _sortVersions($versions)
return $versions_array;
}
+ protected function _clear_cache()
+ {
+ self::$_CACHE = array();
+ }
+
/**
* Add a new record to the branches view, via the productdims and product_visibility tables.
*
@@ -118,6 +139,7 @@ public function add($product, $version, $start_date, $end_date, $featured=false
} catch (Exception $e) {
Kohana::log('error', "Could not add \"$product\" \"$version\" in soc.web branch.add \r\n " . $e->getMessage());
}
+ $this->_clear_cache(); // We have changed the data, so we need to reload it.
return $rv;
}
}
@@ -140,6 +162,7 @@ public function delete($product, $version) {
AND version = ?
", $product, $version
);
+ $this->_clear_cache(); // We have changed the data, so we need to reload it.
return $rv;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.