class Firebolt::WarmCacheJob

Public Instance Methods

perform(warmer_class) click to toggle source
# File lib/firebolt/warm_cache_job.rb, line 4
def perform(warmer_class)
  cache_warmer = warmer_class.new
  results = cache_warmer.warm
  return unless write_results_to_cache_file?

  write_results_to_cache_file(results)
end

Private Instance Methods

cache_file() click to toggle source
# File lib/firebolt/warm_cache_job.rb, line 14
def cache_file
  ::Firebolt.config.cache_file
end
write_results_to_cache_file(results) click to toggle source
# File lib/firebolt/warm_cache_job.rb, line 18
def write_results_to_cache_file(results)
  ::File.open(cache_file, 'w') do |file|
    json_results = ::JSON.dump(results)
    file.write(json_results)
  end
end
write_results_to_cache_file?() click to toggle source
# File lib/firebolt/warm_cache_job.rb, line 25
def write_results_to_cache_file?
  ::Firebolt.config.cache_file_enabled?
end