summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Status.pm
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2014-04-07 10:38:31 +0200
committerByron Jones <glob@mozilla.com>2014-04-07 10:38:31 +0200
commit3ef245b21a397e5253ba1bda607a1510245d5c09 (patch)
tree50175bb633117c7ae264a2e13872ead78ce91530 /Bugzilla/Status.pm
parentdc9486b05615630a5d6165d8a1bd256284c19268 (diff)
downloadbugzilla-3ef245b21a397e5253ba1bda607a1510245d5c09.tar.gz
bugzilla-3ef245b21a397e5253ba1bda607a1510245d5c09.tar.xz
Bug 987032: allow memcached to cache bugzilla configuration information
r=dkl, a=glob
Diffstat (limited to 'Bugzilla/Status.pm')
-rw-r--r--Bugzilla/Status.pm20
1 files changed, 15 insertions, 5 deletions
diff --git a/Bugzilla/Status.pm b/Bugzilla/Status.pm
index 964df9070..1f8862a36 100644
--- a/Bugzilla/Status.pm
+++ b/Bugzilla/Status.pm
@@ -108,11 +108,21 @@ sub _check_value {
sub BUG_STATE_OPEN {
my $dbh = Bugzilla->dbh;
- my $cache = Bugzilla->request_cache;
- $cache->{status_bug_state_open} ||=
- $dbh->selectcol_arrayref('SELECT value FROM bug_status
- WHERE is_open = 1');
- return @{ $cache->{status_bug_state_open} };
+ my $request_cache = Bugzilla->request_cache;
+ my $cache_key = 'status_bug_state_open';
+ return @{ $request_cache->{$cache_key} }
+ if exists $request_cache->{$cache_key};
+
+ my $rows = Bugzilla->memcached->get_config({ key => $cache_key });
+ if (!$rows) {
+ $rows = $dbh->selectcol_arrayref(
+ 'SELECT value FROM bug_status WHERE is_open = 1'
+ );
+ Bugzilla->memcached->set_config({ key => $cache_key, data => $rows });
+ }
+
+ $request_cache->{$cache_key} = $rows;
+ return @$rows;
}
# Tells you whether or not the argument is a valid "open" state.