Skip to content

Commit

Permalink
cache metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
kaisecheng committed Feb 20, 2021
1 parent 1f43986 commit c1d9332
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion x-pack/lib/filters/geoip/database_metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ def save_timestamp(database_path)
metadata.each { |row| csv << row }
end

@cache = metadata
logger.debug("metadata updated", :metadata => metadata)
end

def get_all
file_exist?(@metadata_path)? ::CSV.read(@metadata_path, headers: false) : Array.new
@cache ||= file_exist?(@metadata_path)?
::CSV.read(@metadata_path, headers: false) : Array.new
end

# Give rows of metadata in default database type, or empty array
Expand Down

0 comments on commit c1d9332

Please sign in to comment.