summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/Memcached.pm1
-rw-r--r--extensions/BzAPI/lib/Resources/Bugzilla.pm19
2 files changed, 17 insertions, 3 deletions
diff --git a/Bugzilla/Memcached.pm b/Bugzilla/Memcached.pm
index 6ada1adf8..e8c17876d 100644
--- a/Bugzilla/Memcached.pm
+++ b/Bugzilla/Memcached.pm
@@ -36,6 +36,7 @@ sub _new {
$self->{memcached} = Cache::Memcached::Fast->new({
servers => [ split(/[, ]+/, $servers) ],
namespace => $self->{namespace},
+ max_size => 1024 * 1024 * 2,
});
}
return bless($self, $class);
diff --git a/extensions/BzAPI/lib/Resources/Bugzilla.pm b/extensions/BzAPI/lib/Resources/Bugzilla.pm
index f39cd29f3..a75a28864 100644
--- a/extensions/BzAPI/lib/Resources/Bugzilla.pm
+++ b/extensions/BzAPI/lib/Resources/Bugzilla.pm
@@ -59,6 +59,14 @@ sub get_configuration {
my $user = Bugzilla->user;
my $params = Bugzilla->input_params;
+ my $can_cache = not exists $params->{product} and not exists $params->{flags};
+ my $cache_key = 'bzapi_get_configuration';
+
+ if ($can_cache) {
+ my $result = Bugzilla->memcached->get_config({key => $cache_key});
+ return $result if defined $result;
+ }
+
# Get data from the shadow DB as they don't change very often.
Bugzilla->switch_to_shadow_db;
@@ -120,11 +128,16 @@ sub get_configuration {
my $json;
Bugzilla->template->process('config.json.tmpl', $vars, \$json);
- my $result = {};
if ($json) {
- $result = $self->json->decode($json);
+ my $result = $self->json->decode($json);
+ if ($can_cache) {
+ Bugzilla->memcached->set_config({key => $cache_key, data => $result});
+ }
+ return $result;
+ }
+ else {
+ return {};
}
- return $result;
}
sub get_empty {