Committer: vsukhanov
LJSUP-8888: Display country and city with IP adresses in commentU trunk/cgi-bin/LJ/GeoLocation.pm
Modified: trunk/cgi-bin/LJ/GeoLocation.pm =================================================================== --- trunk/cgi-bin/LJ/GeoLocation.pm 2011-05-27 09:10:40 UTC (rev 10573) +++ trunk/cgi-bin/LJ/GeoLocation.pm 2011-05-27 09:21:39 UTC (rev 10574) @@ -258,6 +258,11 @@ return unless $LJ::USE_IPMAP; return undef unless $city_id; # even 0 is unappropriate + ## 0. In process cache + if (my $self = $LJ::GEO_CITY_INFO_BY_ID{$city_id}){ + return $self; + } + ## 1. Find in memcache my $self = $class->_load_from_memcache($city_id); if ($self) { @@ -301,6 +306,10 @@ $self->{region} = $self->{region_code} if defined $LJ::COUNTRIES_WITH_REGIONS{ $self->{country_short} }; $self->_store_to_memcache; + + ## + $LJ::GEO_CITY_INFO_BY_ID{$city_id} = $self; + return $self; }