Skip to content

Instantly share code, notes, and snippets.

@tbalthazar
Created May 28, 2010 20:30
Show Gist options
  • Save tbalthazar/417697 to your computer and use it in GitHub Desktop.
Save tbalthazar/417697 to your computer and use it in GitHub Desktop.
def index
@last_modified_post = Post.find(:first, :order => "updated_at DESC")
expires_in 0, :public => true
if @last_modified_post.nil? || stale?( :etag => @last_modified_post,
:last_modified => @last_modified_post.updated_at.utc,
:public => true)
logger.error("--\n\n--LAST MODIFIED #{@last_modified_post.updated_at.utc}--\n\n--")
logger.error("--\n\n--INVALID CACHE at #{Time.now.utc}--\n\n--")
logger.error("--\n\n--STALE : #{stale?(:last_modified => @last_modified_post.updated_at.utc, :public => true)}--\n\n--")
@posts = Post.find(:all)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment