Skip to content

Commit

Permalink
Add caching for analytics for 24 hours.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexskr committed Jul 29, 2022
1 parent 47e9804 commit 2414aba
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions controllers/ontology_analytics_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class OntologyAnalyticsController < ApplicationController
namespace "/analytics" do

get do
expires 86400, :public
year = year_param(params)
error 400, "The year you supplied is invalid. Valid years start with 2 and contain 4 digits." if params["year"] && !year
month = month_param(params)
Expand All @@ -24,6 +25,7 @@ class OntologyAnalyticsController < ApplicationController
namespace "/ontologies/:acronym/analytics" do

get do
expires 86400, :public
ont = Ontology.find(params["acronym"]).first
error 404, "No ontology exists with the acronym: #{params["acronym"]}" if ont.nil?
analytics = ont.analytics
Expand Down

0 comments on commit 2414aba

Please sign in to comment.