Skip to content

Commit

Permalink
Merge pull request #221 from brandonsavage/bug709166
Browse files Browse the repository at this point in the history
Bug 709166 - Adding a flag to check and make sure we are refreshing the data from time to time.
  • Loading branch information
rhelmer committed Dec 14, 2011
2 parents a3ebe1d + 491612a commit 5177162
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 5177162

Please sign in to comment.