diff --git a/lib/tasks/app_initializer.rake b/lib/tasks/app_initializer.rake index 9469e35bc..be33afb52 100644 --- a/lib/tasks/app_initializer.rake +++ b/lib/tasks/app_initializer.rake @@ -12,6 +12,7 @@ namespace :app_initializer do Rake::Task["data_updates:enqueue_data_update_worker"].execute puts "\n== Bust Caches ==" + Rake::Task["cache:clear_app_cache"].execute unless Rails.env.production? Rake::Task["cache:enqueue_path_bust_workers"].execute Settings::General.health_check_token ||= SecureRandom.hex(10) diff --git a/lib/tasks/cache.rake b/lib/tasks/cache.rake index 00a96521e..9520b9fce 100644 --- a/lib/tasks/cache.rake +++ b/lib/tasks/cache.rake @@ -7,4 +7,11 @@ namespace :cache do BustCachePathWorker.set(queue: :high_priority).perform_in(n.seconds, "/onboarding") end end + + desc "Clear application cache" + task clear_app_cache: :environment do + raise "Attempting to clear Rails cache in production" if Rails.env.production? + + Rails.cache.clear + end end