madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r22752: LJSUP-13445: Home page optimization: sta...

Committer: sbelyaev
LJSUP-13445: Home page optimization: stage 2
U   trunk/cgi-bin/ljlib.pl
Modified: trunk/cgi-bin/ljlib.pl
===================================================================
--- trunk/cgi-bin/ljlib.pl	2012-08-28 10:28:33 UTC (rev 22751)
+++ trunk/cgi-bin/ljlib.pl	2012-08-28 12:01:07 UTC (rev 22752)
@@ -2343,6 +2343,7 @@
     %LJ::_ML_USED_STRINGS = ();       # strings looked up in this web request
     %LJ::REQ_CACHE_USERTAGS = ();     # uid -> { ... }; populated by get_usertags, so we don't load it twice
     %LJ::LOCK_OUT = ();
+    %LJ::SECRET = ();                 # secret key -> secret value
 
     $LJ::VERTICALS_FORCE_USE_MASTER = 0;    # It need to load a new created category from master insteed slave server.
 
@@ -3197,7 +3198,12 @@
     }
 
     my $memkey = "secret:$time";
-    my $secret = LJ::MemCache::get($memkey);
+    my $secret = $LJ::SECRET{$memkey};
+    if (!$secret) {
+        $secret = LJ::MemCache::get($memkey);
+        $LJ::SECRET{$memkey} = $secret;
+    }
+
     return $want_new ? ($time, $secret) : $secret if $secret;
 
     my $dbh = LJ::get_db_writer();
@@ -3205,6 +3211,7 @@
     $secret = $dbh->selectrow_array("SELECT secret FROM secrets ".
                                     "WHERE stime=?", undef, $time);
     if ($secret) {
+        $LJ::SECRET{$memkey} = $secret;
         LJ::MemCache::set($memkey, $secret) if $secret;
         return $want_new ? ($time, $secret) : $secret;
     }

Tags: livejournal, madeon, pl, 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