diff options
author | Dylan Hardison <dylan@mozilla.com> | 2016-02-29 19:16:41 +0100 |
---|---|---|
committer | Dylan Hardison <dylan@mozilla.com> | 2016-02-29 19:16:41 +0100 |
commit | 438d57d65626d068ca0f28de46410ebecc9a9b57 (patch) | |
tree | 752b74de9b670fedcd14c524bf352befba085ff3 | |
parent | 9343e3ad73291a7a0f0cb890335523298cec68a5 (diff) | |
download | bugzilla-438d57d65626d068ca0f28de46410ebecc9a9b57.tar.gz bugzilla-438d57d65626d068ca0f28de46410ebecc9a9b57.tar.xz |
Bug 1251208 - Bugzilla->request_cache() can be faster
r=dkl,a=dylan
-rw-r--r-- | Bugzilla.pm | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/Bugzilla.pm b/Bugzilla.pm index 2761c9fc7..851b76ebb 100644 --- a/Bugzilla.pm +++ b/Bugzilla.pm @@ -684,43 +684,21 @@ sub local_timezone { ||= DateTime::TimeZone->new(name => 'local'); } -# This creates the request cache for non-mod_perl installations. -# This is identical to Install::Util::_cache so that things loaded -# into Install::Util::_cache during installation can be read out -# of request_cache later in installation. -our $_request_cache = $Bugzilla::Install::Util::_cache; - -sub request_cache { - if ($ENV{MOD_PERL}) { - require Apache2::RequestUtil; - # Sometimes (for example, during mod_perl.pl), the request - # object isn't available, and we should use $_request_cache instead. - my $request = eval { Apache2::RequestUtil->request }; - return $_request_cache if !$request; - return $request->pnotes(); - } - return $_request_cache; -} +my $request_cache = {}; + +sub request_cache { return $request_cache } sub clear_request_cache { - $_request_cache = {}; - if ($ENV{MOD_PERL}) { - require Apache2::RequestUtil; - my $request = eval { Apache2::RequestUtil->request }; - if ($request) { - my $pnotes = $request->pnotes; - delete @$pnotes{(keys %$pnotes)}; - } - } + %$request_cache = (); } # This is a per-process cache. Under mod_cgi it's identical to the # request_cache. When using mod_perl, items in this cache live until the # worker process is terminated. -our $_process_cache = {}; +my $process_cache = {}; sub process_cache { - return $_process_cache; + return $process_cache; } # This is a memcached wrapper, which provides cross-process and cross-system |