our $_localconfig;
sub localconfig {
- $_localconfig ||= read_localconfig();
- return $_localconfig;
+ return $_[0]->process_cache->{localconfig} ||= read_localconfig();
}
sub params {
return $_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 = {};
+
+sub process_cache {
+ return $_process_cache;
+}
+
# Private methods
# Per-process cleanup. Note that this is a plain subroutine, not a method,
use constant FORMAT_DOUBLE => '%19s %-55s';
use constant FORMAT_2_SIZE => [19,55];
-# Use a per-process provider to cache compiled templates in memory across
-# requests.
-our %shared_providers;
-
# Pseudo-constant.
sub SAFE_URL_REGEXP {
my $safe_protocols = join('|', SAFE_PROTOCOLS);
'default_authorizer' => new Bugzilla::Auth(),
},
};
+ # Use a per-process provider to cache compiled templates in memory across
+ # requests.
my $provider_key = join(':', @{ $config->{INCLUDE_PATH} });
- $shared_providers{$provider_key} ||= Template::Provider->new($config);
- $config->{LOAD_TEMPLATES} = [ $shared_providers{$provider_key} ];
+ my $shared_providers = Bugzilla->process_cache->{shared_providers} ||= {};
+ $shared_providers->{$provider_key} ||= Template::Provider->new($config);
+ $config->{LOAD_TEMPLATES} = [ $shared_providers->{$provider_key} ];
local $Template::Config::CONTEXT = 'Bugzilla::Template::Context';
}
# Clear out the cached Provider object
- undef %shared_providers;
+ Bugzilla->process_cache->{shared_providers} = undef;
}
# Under mod_perl, we look for templates using the absolute path of the