diff options
author | Byron Jones <glob@mozilla.com> | 2014-04-07 10:38:31 +0200 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2014-04-07 10:38:31 +0200 |
commit | 3ef245b21a397e5253ba1bda607a1510245d5c09 (patch) | |
tree | 50175bb633117c7ae264a2e13872ead78ce91530 /Bugzilla/User.pm | |
parent | dc9486b05615630a5d6165d8a1bd256284c19268 (diff) | |
download | bugzilla-3ef245b21a397e5253ba1bda607a1510245d5c09.tar.gz bugzilla-3ef245b21a397e5253ba1bda607a1510245d5c09.tar.xz |
Bug 987032: allow memcached to cache bugzilla configuration information
r=dkl, a=glob
Diffstat (limited to 'Bugzilla/User.pm')
-rw-r--r-- | Bugzilla/User.pm | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 4f047ebdd..c37ab23f3 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -675,13 +675,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); } |