class GeoDataFromRequest
  attr_accessor :request, :geo_data

  def initialize(request)
    @request = request
  end

  def geo_data
    @geo_data = existing_value || request.location

    redis.set(ip, Marshal.dump(@geo_data)) unless existing_value

    @geo_data
  end

  private
  def redis
    @redis ||= Redis.new
  end

  def ip
    @ip ||= request.remote_addr
  end

  def existing_value
    geo_data_as_dump = redis.get(ip)
    geo_data_as_dump.present? ? Marshal.load(geo_data_as_dump) : nil
  end
end

class GeoDataFromRequest
  attr_accessor :request, :geo_data

  def initialize(request)
    @request = request
  end

  def geo_data
    @geo_data = existing_value || request.location

    redis.set(ip, Marshal.dump(@geo_data)) unless existing_value

    @geo_data
  end

  private
  def redis
    @redis ||= Redis.new
  end

  def ip
    @ip ||= request.remote_addr
  end

  def existing_value
    geo_data_as_dump = redis.get(ip)
    geo_data_as_dump && !geo_data_as_dump.empty? ? Marshal.load(geo_data_as_dump) : nil
  end
end

Fix issue w/ .present? invalid byte sequences
Fix issue w/ .present? invalid byte sequences

Look up of existing geo coder results was triggering failure.
