From 9193214274889f2b7636146e72d8200e9bfaeb7b Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Tue, 4 Mar 2014 15:50:54 +0800 Subject: Bug 966180: backport bug 956233 to bmo (enable USE_MEMCACHE on most objects) --- Bugzilla/Object.pm | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'Bugzilla/Object.pm') diff --git a/Bugzilla/Object.pm b/Bugzilla/Object.pm index 43d2c07ac..936465b3f 100644 --- a/Bugzilla/Object.pm +++ b/Bugzilla/Object.pm @@ -48,9 +48,8 @@ use constant AUDIT_UPDATES => 1; use constant AUDIT_REMOVES => 1; # When USE_MEMCACHED is true, the class is suitable for serialisation to -# Memcached. This will be flipped to true by default once the majority of -# Bugzilla Object have been tested with Memcached. -use constant USE_MEMCACHED => 0; +# Memcached. See documentation in Bugzilla::Memcached for more information. +use constant USE_MEMCACHED => 1; # This allows the JSON-RPC interface to return Bugzilla::Object instances # as though they were hashes. In the future, this may be modified to return @@ -188,7 +187,20 @@ sub new_from_list { # their own implementation of match which is not compatible # with this one. However, match() still needs to have the right $invocant # in order to do $class->DB_TABLE and so on. - return match($invocant, { $id_field => \@detainted_ids }); + my $list = match($invocant, { $id_field => \@detainted_ids }); + + # BMO: Populate the object cache with bug objects, which helps + # inline-history when viewing bugs with dependencies. + if ($class eq 'Bugzilla::Bug') { + foreach my $object (@$list) { + $class->_object_cache_set( + { id => $object->id, cache => 1 }, + $object + ); + } + } + + return $list; } sub new_from_hash { -- cgit v1.2.3-24-g4f1b