summaryrefslogtreecommitdiffstats
path: root/Bugzilla/User.pm
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2014-05-12 07:49:53 +0200
committerByron Jones <glob@mozilla.com>2014-05-12 07:49:53 +0200
commit3ff56a88eebef3699df7e524dea89be7b593337f (patch)
tree5cb921c3b7a0699e4c01594b6faabbd6b12c2535 /Bugzilla/User.pm
parent02954330c3c5f4d13dc4b4c287af21edff64043f (diff)
downloadbugzilla-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/User.pm')
-rw-r--r--Bugzilla/User.pm20
1 files changed, 15 insertions, 5 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index 98aa78e0a..4c0b18250 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -683,13 +683,23 @@ sub groups {
FROM user_group_map
WHERE user_id = ? AND isbless = 0}, undef, $self->id);
- my $rows = $dbh->selectall_arrayref(
- "SELECT DISTINCT grantor_id, member_id
- FROM group_group_map
- WHERE grant_type = " . GROUP_MEMBERSHIP);
+ my $cache_key = 'group_grant_type_' . GROUP_MEMBERSHIP;
+ my $membership_rows = Bugzilla->memcached->get_config({
+ key => $cache_key,
+ });
+ if (!$membership_rows) {
+ $membership_rows = $dbh->selectall_arrayref(
+ "SELECT DISTINCT grantor_id, member_id
+ FROM group_group_map
+ WHERE grant_type = " . GROUP_MEMBERSHIP);
+ Bugzilla->memcached->set_config({
+ key => $cache_key,
+ data => $membership_rows,
+ });
+ }
my %group_membership;
- foreach my $row (@$rows) {
+ foreach my $row (@$membership_rows) {
my ($grantor_id, $member_id) = @$row;
push (@{ $group_membership{$member_id} }, $grantor_id);
}