Committer: sbelyaev
LJSUP-13301: Main page optimizationU trunk/cgi-bin/LJ/Widget/FriendBirthdays.pm
Modified: trunk/cgi-bin/LJ/Widget/FriendBirthdays.pm =================================================================== --- trunk/cgi-bin/LJ/Widget/FriendBirthdays.pm 2012-08-20 11:00:41 UTC (rev 22701) +++ trunk/cgi-bin/LJ/Widget/FriendBirthdays.pm 2012-08-20 11:33:49 UTC (rev 22702) @@ -19,6 +19,13 @@ my $u = $opts{user} && LJ::isu($opts{user}) ? $opts{user} : LJ::get_remote(); return "" unless $u; + my $cache_key = "friend_birthdays:" . $u->userid; + my $cache_data = LJ::MemCache::get($cache_key); + if ($cache_data) { + return $cache_data; + } + + my $limit = defined $opts{limit} ? $opts{limit} : 5; my @bdays = $u->get_friends_birthdays( months_ahead => 1 ); @@ -27,12 +34,6 @@ return "" unless @bdays; - my $cache_key = "friend_birthdays:" . $u->userid; - my $cache_data = LJ::MemCache::get($cache_key); - if ($cache_data) { - return $cache_data; - } - my $ret; $ret .= '<div class="right-mod"><div class="mod-tl"><div class="mod-tr"><div class="mod-br"><div class="mod-bl">';