Committer: sbelyaev
LJSUP-13883: Journal pages optimizaiton : stage 1U trunk/cgi-bin/LJ/S2/RecentPage.pm U trunk/cgi-bin/LJ/User.pm
Modified: trunk/cgi-bin/LJ/S2/RecentPage.pm =================================================================== --- trunk/cgi-bin/LJ/S2/RecentPage.pm 2012-10-11 13:21:45 UTC (rev 23114) +++ trunk/cgi-bin/LJ/S2/RecentPage.pm 2012-10-11 13:33:43 UTC (rev 23115) @@ -155,6 +155,7 @@ LJ::MemCacheProxy::get_multi( @prefetch_keys ); + $u->prefetch_subscriptions(); # load tags my $idsbyc = { $u->{clusterid} => [ ] }; Modified: trunk/cgi-bin/LJ/User.pm =================================================================== --- trunk/cgi-bin/LJ/User.pm 2012-10-11 13:21:45 UTC (rev 23114) +++ trunk/cgi-bin/LJ/User.pm 2012-10-11 13:33:43 UTC (rev 23115) @@ -454,6 +454,12 @@ LJ::load_user_props($u, @_); } +sub prefetch_subscriptions { + my $u = shift; + my @subs = LJ::Subscription->find($u, prefetch => 1); + $u->{__subscriptions} = @subs; +} + sub readonly { my $u = shift; return LJ::get_cap($u, "readonly"); @@ -3661,6 +3667,9 @@ my ($u, %params) = @_; croak "No parameters" unless %params; + $params{postprocess} = $u->{__subscriptions} + unless $params{postprocess}; + return LJ::Subscription->find($u, %params); }