Created
May 23, 2012 15:35
-
-
Save ktopping/2775936 to your computer and use it in GitHub Desktop.
cache headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def images | |
... authenticate | |
... get @images from somewhere | |
... get user_id and brochure_id from somewhere | |
if stale?(:etag => Image.images_key(@images, "#{user_id},#{brochure_id}")) | |
respond_to do |format| | |
format.json { | |
response.headers['Cache-Control'] = 'public, max-age=2592000' # 1 month | |
render :content_type => "application/json"; # render via view | |
} | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment