Commit 919df77f authored by Nigel Kukard's avatar Nigel Kukard
Browse files

* Cache policy group members

parent f04f5943
......@@ -82,8 +82,9 @@ sub Init
$ch = Cache::FastMmap->new(
'page_size' => 2048,
'num_pages' => 1000,
'expire_time' => 300,
'raw_values' => 1,
'unlink_on_exit' => 1,
'unlink_on_exit' => 1,
);
# Stats
......
......@@ -226,6 +226,16 @@ sub getGroupMembers
my $group = shift;
# Check cache
my ($cache_res,$cache) = cacheGetKeyPair('Policies/Groups/Name-to-Members',$group);
if ($cache_res) {
return cbp::cache::Error();
}
if (defined($cache)) {
my @groupMembers = split(/,/,$cache);
return \@groupMembers;
}
# Grab group members
my $sth = DBSelect('
SELECT
......@@ -249,6 +259,12 @@ sub getGroupMembers
push(@groupMembers,$row->{'member'});
}
# Cache this
$cache_res = cacheStoreKeyPair('Policies/Groups/Name-to-Members',$group,join(',',@groupMembers));
if ($cache_res) {
return cbp::cache::Error();
}
return \@groupMembers;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment