Committer: sbelyaev
LJSUP-13883: Journal pages optimizaiton : stage 1U trunk/cgi-bin/LJ/MemCacheProxy.pm
Modified: trunk/cgi-bin/LJ/MemCacheProxy.pm =================================================================== --- trunk/cgi-bin/LJ/MemCacheProxy.pm 2012-10-11 10:46:05 UTC (rev 23103) +++ trunk/cgi-bin/LJ/MemCacheProxy.pm 2012-10-11 10:46:44 UTC (rev 23104) @@ -81,5 +81,14 @@ return LJ::MemCache::replace($key_origin, $value, $expire); } +sub add { + my ( $key_origin, $value, $expire ) = @_; + my $key = ref $key_origin eq 'ARRAY' ? $key_origin->[1] : $key_origin; + + $singletons{$key} = $value unless $singletons{$key}; + + return LJ::MemCache::replace($key_origin, $value, $expire); +} + 1;