diff --git a/app/controllers/api/public/v1/courses_controller.rb b/app/controllers/api/public/v1/courses_controller.rb index 024f3f99ba..6bbf6040c7 100644 --- a/app/controllers/api/public/v1/courses_controller.rb +++ b/app/controllers/api/public/v1/courses_controller.rb @@ -18,12 +18,8 @@ def index def cached_course_count year = permitted_params[:recruitment_cycle_year] || RecruitmentCycle.current.year - if permitted_params[:no_cache] + Rails.cache.fetch("api_course_count_#{year}", expires_in: 5.minutes) do courses.count('course.id') - else - Rails.cache.fetch("api_course_count_#{year}", expires_in: 5.minutes) do - courses.count('course.id') - end end end @@ -40,7 +36,7 @@ def include_param end def permitted_params - params.permit('page', 'no_cache', 'sort', 'per_page', 'courses', 'recruitment_cycle_year', 'include', 'filter' => %w[updated_since funding_type]) + params.permit('page', 'sort', 'per_page', 'courses', 'recruitment_cycle_year', 'include', 'filter' => %w[updated_since funding_type]) end end end