Skip to content

Instantly share code, notes, and snippets.

@Gregg
Created February 25, 2009 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gregg/70478 to your computer and use it in GitHub Desktop.
Save Gregg/70478 to your computer and use it in GitHub Desktop.
# To set max-age
expires_in 10.minutes
# To set the etag
if stale?(:etag => @user)
# or
fresh_when(:etag => @user)
# You can also send in multiple models
if stale?(:etag => [@user, @post])
# To set last_modified
if stale?(:last_modified => @user.updated_at.utc)
# or
fresh_when :last_modified => @user.updated_at.utc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment