Skip to content

Commit

Permalink
Remove no_cache api param
Browse files Browse the repository at this point in the history
  • Loading branch information
inulty-dfe committed Dec 2, 2024
1 parent a74324c commit d85cc05
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions app/controllers/api/public/v1/courses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit d85cc05

Please sign in to comment.