Skip to content

Commit

Permalink
Bug 709166 - Adding a flag to check and make sure we are refreshing t…
Browse files Browse the repository at this point in the history
…he data from time to time.
  • Loading branch information
brandonsavage authored and lonnen committed Dec 16, 2011
1 parent 89e98bb commit d24fa71
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion webapp-php/application/models/branch.php
Expand Up @@ -50,6 +50,7 @@ class Branch_Model extends Model {

protected static $_CACHE = array();
protected $_cache_obj;
protected $cache_changed = false;

public function __construct()
{
Expand All @@ -63,7 +64,9 @@ public function __construct()

public function __destruct()
{
$this->_cache_obj->set('branch.cache.objects', self::$_CACHE, NULL, 1800);
if($this->cache_changed) {
$this->_cache_obj->set('branch.cache.objects', self::$_CACHE, NULL, 1800);
}
}

protected function _getValues(array $order_by = array(), $ignore_cache = false) {
Expand All @@ -85,6 +88,7 @@ protected function _getValues(array $order_by = array(), $ignore_cache = false)
$resp = $service->get("${host}/current/versions/${from}");
if($order_by && !$ignore_cache) {
self::$_CACHE[md5($order_by)] = $resp->currentversions;
$this->cache_changed = true;
}
return $resp->currentversions;
}
Expand Down

0 comments on commit d24fa71

Please sign in to comment.