def load_tracker_cache(load_soa_serial = true)
cache = Cache.new
filename = get_tracker_filename
dir = File.dirname(filename)
begin
Dir.mkdir(dir) unless File.directory?(dir)
rescue Errno::ENOENT
@parent.log(LOG_ERR, "Can't create working folder : #{dir}")
KASPAuditor.exit("Can't create working folder : #{dir}", 1)
end
File.open(filename, File::CREAT) { |f|
count = 0
while (line = f.gets)
count += 1
if (count == 1)
@initial_timestamp = line.chomp.to_i
next
elsif (count == 2)
if (load_soa_serial)
@last_soa_serial = line.chomp.to_i
end
next
end
key_string, status_string, time, first_time = line.split(SEPARATOR)
if (!first_time)
first_time = time
end
key = RR.create(key_string)
eval "cache.add_#{status_string.downcase}_key_with_time(key, time.to_i, first_time.to_i)".untaint
end
}
return cache
end