diff options
| author | mo khan <mo@mokhan.ca> | 2013-12-28 18:46:45 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2013-12-28 18:46:45 -0700 |
| commit | fd084d5c9ed6e4aa1f31a7ee0c0f4e5ac3ba214e (patch) | |
| tree | 42d42eb409a2395a5bbf6c13fc14c7826684576b /app/controllers/tutorials_controller.rb | |
| parent | 0969fb8ad3053fd1141ffcc775c90bb36166c560 (diff) | |
cache tutorials using cache-control headers and etag.
Diffstat (limited to 'app/controllers/tutorials_controller.rb')
| -rw-r--r-- | app/controllers/tutorials_controller.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/controllers/tutorials_controller.rb b/app/controllers/tutorials_controller.rb index 6080f275..b9b70653 100644 --- a/app/controllers/tutorials_controller.rb +++ b/app/controllers/tutorials_controller.rb @@ -3,10 +3,14 @@ class TutorialsController < ApplicationController def index @tutorials = Tutorial.includes(:tags).page(params[:page]).per(15) + expires_in(10.minutes) + fresh_when(Tutorial.maximum(:updated_at)) if Tutorial.any? end def show @tutorial = Tutorial.find(params[:id]) + expires_in(24.hours) + fresh_when(@tutorial) end def new |
