diff options
author | Byron Jones <bjones@mozilla.com> | 2012-12-19 09:56:47 +0100 |
---|---|---|
committer | Byron Jones <bjones@mozilla.com> | 2012-12-19 09:56:47 +0100 |
commit | 387608caac85ccf6c0782572420ecbdae4e301bf (patch) | |
tree | a047006cbf485bb714dea61b39731e28a1366fca /Bugzilla/Component.pm | |
parent | e068bcc76fe842fbcac8249ed29593f8a17b0c24 (diff) | |
download | bugzilla-387608caac85ccf6c0782572420ecbdae4e301bf.tar.gz bugzilla-387608caac85ccf6c0782572420ecbdae4e301bf.tar.xz |
Bug 815532: Add caching for Bugzilla::User objects
r=dkl,a=LpSolit
Diffstat (limited to 'Bugzilla/Component.pm')
-rw-r--r-- | Bugzilla/Component.pm | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/Bugzilla/Component.pm b/Bugzilla/Component.pm index 53a6f216c..3fb87de6f 100644 --- a/Bugzilla/Component.pm +++ b/Bugzilla/Component.pm @@ -342,23 +342,16 @@ sub bug_ids { sub default_assignee { my $self = shift; - if (!defined $self->{'default_assignee'}) { - $self->{'default_assignee'} = - new Bugzilla::User($self->{'initialowner'}); - } - return $self->{'default_assignee'}; + return $self->{'default_assignee'} + ||= new Bugzilla::User({ id => $self->{'initialowner'}, cache => 1 }); } sub default_qa_contact { my $self = shift; - return if !$self->{'initialqacontact'}; - - if (!defined $self->{'default_qa_contact'}) { - $self->{'default_qa_contact'} = - new Bugzilla::User($self->{'initialqacontact'}); - } - return $self->{'default_qa_contact'}; + return unless $self->{'initialqacontact'}; + return $self->{'default_qa_contact'} + ||= new Bugzilla::User({id => $self->{'initialqacontact'}, cache => 1 }); } sub flag_types { |