Define cache expire times for JSON requests
JSON requests are very expensive. Make sure they are cached for long enough.
This commit is contained in:
parent
df94be866e
commit
82003ca1bf
1 changed files with 4 additions and 0 deletions
|
|
@ -1,21 +1,25 @@
|
||||||
class JsonController < ApplicationController
|
class JsonController < ApplicationController
|
||||||
# JSON information on a single package
|
# JSON information on a single package
|
||||||
def package
|
def package
|
||||||
|
expires_in 1.hours, public: true
|
||||||
@p = Package.find_by_name! params[:name]
|
@p = Package.find_by_name! params[:name]
|
||||||
end
|
end
|
||||||
|
|
||||||
# JSON information on all packages
|
# JSON information on all packages
|
||||||
def packages
|
def packages
|
||||||
|
expires_in 1.days, public: true
|
||||||
@p = Package.all
|
@p = Package.all
|
||||||
end
|
end
|
||||||
|
|
||||||
# JSON information on all screenshots
|
# JSON information on all screenshots
|
||||||
def screenshots
|
def screenshots
|
||||||
|
expires_in 1.days, public: true
|
||||||
@s = Screenshot.includes(:package)
|
@s = Screenshot.includes(:package)
|
||||||
end
|
end
|
||||||
|
|
||||||
# JSON list of packages that do not have screenshots
|
# JSON list of packages that do not have screenshots
|
||||||
def packages_without_screenshots
|
def packages_without_screenshots
|
||||||
|
expires_in 1.hours, public: true
|
||||||
@p = Package.without_screenshots.all
|
@p = Package.without_screenshots.all
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue