Skip to content

Commit

Permalink
bug 718056 - add configurable cache to the branch model
Browse files Browse the repository at this point in the history
  • Loading branch information
lonnen committed Jan 13, 2012
1 parent bf9e588 commit 1fd1dd5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions webapp-php/application/config/webserviceclient.php-dist
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ $config['basic_auth'] = array('username' => 'example',
$config['topcrash_vers_rank_cache_minutes'] = 60;
$config['hang_report_cache_minutes'] = 60;

/**
* Number of minutes to cache the branch model webservice calls, which populates
* common ui elements throughout the app.
*/
$config['branch_model_cache_minutes'] = 60;

/**
* What implementation is used in the Middleware.
* Can be 'ES' for ElasticSearch or 'PG' for PostgreSQL.
Expand Down
3 changes: 2 additions & 1 deletion webapp-php/application/models/branch.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ protected function _getValues(array $order_by = array()) {
$service = new Web_Service($config);
$host = Kohana::config('webserviceclient.socorro_hostname');
$from = rawurlencode($order_by);
$resp = $service->get("${host}/current/versions/${from}");
$lifetime = Kohana::config('webserviceclient.branch_model_cache_in_minutes', 60) * 60;
$resp = $service->get("${host}/current/versions/${from}", 'json', $lifetime);

return $resp->currentversions;
}
Expand Down

0 comments on commit 1fd1dd5

Please sign in to comment.