Slide 8
Slide 8 text
module CacheController
protected
def uncache_it
headers['Cache-Control'] = 'max-age=0, private, must-revalidate'
end
def cache_it(max_age = 30)
headers['Vary'] = 'Accept'
expires_in max_age, :public => true
end
def etag_it(is_public = true)
headers['Vary'] = 'Accept'
fresh_when(:last_modified => resource.updated_at.utc,
:etag => resource, :public => is_public)
end
end
Wednesday, December 5, 12