diff options
author | Byron Jones <glob@mozilla.com> | 2014-05-12 07:49:53 +0200 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2014-05-12 07:49:53 +0200 |
commit | 3ff56a88eebef3699df7e524dea89be7b593337f (patch) | |
tree | 5cb921c3b7a0699e4c01594b6faabbd6b12c2535 /Bugzilla/Status.pm | |
parent | 02954330c3c5f4d13dc4b4c287af21edff64043f (diff) | |
download | bugzilla-3ff56a88eebef3699df7e524dea89be7b593337f.tar.gz bugzilla-3ff56a88eebef3699df7e524dea89be7b593337f.tar.xz |
Bug 992767: backport bug 987032 to bmo (allow memcached to cache bugzilla configuration information)
Diffstat (limited to 'Bugzilla/Status.pm')
-rw-r--r-- | Bugzilla/Status.pm | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/Bugzilla/Status.pm b/Bugzilla/Status.pm index ffef600de..4a82f68d0 100644 --- a/Bugzilla/Status.pm +++ b/Bugzilla/Status.pm @@ -126,11 +126,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. |