From 3ff56a88eebef3699df7e524dea89be7b593337f Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Mon, 12 May 2014 13:49:53 +0800 Subject: Bug 992767: backport bug 987032 to bmo (allow memcached to cache bugzilla configuration information) --- Bugzilla/Status.pm | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'Bugzilla/Status.pm') 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. -- cgit v1.2.3-24-g4f1b