Committer: sbelyaev
LJSUP-13883: Journal pages optimizaiton : stage 1U trunk/cgi-bin/LJ/S2/RecentPage.pm U trunk/cgi-bin/LJ/Share.pm
Modified: trunk/cgi-bin/LJ/S2/RecentPage.pm =================================================================== --- trunk/cgi-bin/LJ/S2/RecentPage.pm 2012-10-11 12:19:57 UTC (rev 23111) +++ trunk/cgi-bin/LJ/S2/RecentPage.pm 2012-10-11 12:54:16 UTC (rev 23112) @@ -123,8 +123,8 @@ die $err if $err; # preload js for sharing - LJ::MemCacheProxy::get_multi( - map { "s2:cache:share:js:" . $u->{'userid'} . ":$_" } @itemids ); + my @prefetch_keys = + map { [$u->{'userid'}, ,"s2:cache:share:js:" . $u->{'userid'} . ":$_"] } @itemids ; ### load the log properties my %logprops = (); @@ -146,12 +146,16 @@ # prefetch userpic infomation and userids # if (%apu) { - LJ::MemCacheProxy::get_multi( map { [$_, "upicinf:$_"] } keys %apu ); - LJ::MemCacheProxy::get_multi( map { [$_, "upiccom:$_"] } keys %apu ); + push @prefetch_keys, map { [$_, "upicinf:$_"] } keys %apu; + push @prefetch_keys, map { [$_, "upiccom:$_"] } keys %apu; + LJ::load_userids_multiple([map { $_, \$apu{$_} } keys %apu], [$u]); $apu_lite{$_} = UserLite($apu{$_}) foreach keys %apu; } + + LJ::MemCacheProxy::get_multi( @prefetch_keys ); + # load tags my $idsbyc = { $u->{clusterid} => [ ] }; push @{$idsbyc->{$u->{clusterid}}}, [ $u->{userid}, $_->{itemid} ] Modified: trunk/cgi-bin/LJ/Share.pm =================================================================== --- trunk/cgi-bin/LJ/Share.pm 2012-10-11 12:19:57 UTC (rev 23111) +++ trunk/cgi-bin/LJ/Share.pm 2012-10-11 12:54:16 UTC (rev 23112) @@ -80,8 +80,9 @@ my $cache_key; if ( my $entry = delete $opts->{'entry'} ) { unless (%$opts) { - $cache_key = 's2:cache:share:js:' . - $entry->journalid . ":" . $entry->jitemid; + $cache_key = [$entry->journalid, + 's2:cache:share:js:' . + $entry->journalid . ":" . $entry->jitemid]; my $data = LJ::MemCacheProxy::get($cache_key); return $data if $data;