debshots/app/controllers/json_controller.rb
Christoph Haas 82003ca1bf Define cache expire times for JSON requests
JSON requests are very expensive. Make sure they are cached for long
enough.
2016-07-13 14:22:28 +02:00

25 lines
623 B
Ruby

class JsonController < ApplicationController
# JSON information on a single package
def package
expires_in 1.hours, public: true
@p = Package.find_by_name! params[:name]
end
# JSON information on all packages
def packages
expires_in 1.days, public: true
@p = Package.all
end
# JSON information on all screenshots
def screenshots
expires_in 1.days, public: true
@s = Screenshot.includes(:package)
end
# JSON list of packages that do not have screenshots
def packages_without_screenshots
expires_in 1.hours, public: true
@p = Package.without_screenshots.all
end
end