madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r22653: LJSUP-13301: Main page optimization

Committer: sbelyaev
LJSUP-13301: Main page optimization
U   trunk/cgi-bin/LJ/Widget/FriendUpdates.pm
Modified: trunk/cgi-bin/LJ/Widget/FriendUpdates.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/FriendUpdates.pm	2012-08-15 11:21:36 UTC (rev 22652)
+++ trunk/cgi-bin/LJ/Widget/FriendUpdates.pm	2012-08-15 11:28:33 UTC (rev 22653)
@@ -20,6 +20,12 @@
 
     my $limit = defined $opts{limit} ? $opts{limit} : 5;
 
+    my $cache_inbox_key  = "friend_updates:" . $u->userid;
+    my $cache_inbox_data = LJ::MemCache::get($cache_inbox_key);
+    if ($cache_inbox_data) {
+        return $cache_inbox_data;
+    }
+
     my $inbox = $u->notification_inbox;
     my @notifications = ();
     if ($inbox) {
@@ -51,6 +57,7 @@
 
     $ret .= '</div></div></div></div></div></div>';
 
+    LJ::MemCache::set($cache_inbox_key, $ret, 84600);
 
     return $ret;
 }

Tags: livejournal, madeon, pm, sbelyaev
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments