madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r23069: LJSUP-13604: Local cache [internal]

Committer: sbelyaev
LJSUP-13604: Local cache [internal]
U   trunk/cgi-bin/LJ/Lang.pm
U   trunk/cgi-bin/LJ/LocalCache/Redis.pm
Modified: trunk/cgi-bin/LJ/Lang.pm
===================================================================
--- trunk/cgi-bin/LJ/Lang.pm	2012-10-09 08:39:42 UTC (rev 23068)
+++ trunk/cgi-bin/LJ/Lang.pm	2012-10-09 08:40:16 UTC (rev 23069)
@@ -745,7 +745,7 @@
         my @keys = keys %memkeys;
 
         my $mem_local = LJ::LocalCache::get_cache()->get_multi( \@keys, \@keys_memcache );
-           $mem = LJ::MemCache::get_multi( @keys_memcache ) || {};
+           $mem = LJ::MemCache::get_multi( @keys_memcache ) if @keys_memcache;
 
         foreach my $key (keys %$mem) {
             LJ::LocalCache::get_cache()->set($key, $mem->{$key}, 30*60);

Modified: trunk/cgi-bin/LJ/LocalCache/Redis.pm
===================================================================
--- trunk/cgi-bin/LJ/LocalCache/Redis.pm	2012-10-09 08:39:42 UTC (rev 23068)
+++ trunk/cgi-bin/LJ/LocalCache/Redis.pm	2012-10-09 08:40:16 UTC (rev 23069)
@@ -4,7 +4,6 @@
 use strict;
 use warnings;
 
-use Encode;
 use Redis;
 
 my $local_connection;
@@ -58,10 +57,7 @@
         return;
     }
 
-    my $value = $connection->get($key);
-    # Redis 1.2001 enable utf8 for received data
-    Encode::_utf8_off($value);
-    return $value;
+    return $connection->get($key);
 }
 
 sub get_multi {
@@ -80,7 +76,6 @@
         my $value = shift @data;
 
         if ($value) {
-            Encode::_utf8_off($value);
             $result->{$key} = $value;
         } else {
             push @{$not_fetched_keys}, $key;
@@ -207,10 +202,7 @@
         return undef;
     }
 
-    my $value = $connection->lpop($key);
-    return unless $value;
-    Encode::_utf8_off($value);
-    return return $value;;
+    return $connection->lpop($key);
 }
 
 sub rpop {
@@ -221,10 +213,7 @@
         return undef;
     }
 
-    my $value = $connection->rpop($key);
-    return unless $value;
-    Encode::_utf8_off($value);
-    return $value;
+    return $connection->rpop($key);
 }
 
 1;

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