Permalink
Browse files

Add HTTP caching (closes #2)

  • Loading branch information...
1 parent c970a89 commit 6e96a3f7e10310d84919100d6abdd6834da5bd4e @judofyr judofyr committed Oct 3, 2010
Showing with 4 additions and 0 deletions.
  1. +4 −0 timeless.rb
View
@@ -39,6 +39,7 @@ def service(*a)
module Timeless::Controllers
class Index
def get
+ @headers['Cache-Control'] = 'public, max-age=3600'
@change = Change.last
render :index
end
@@ -55,13 +56,15 @@ def get
class Changelog < R '/changelog'
def get
+ @headers['Cache-Control'] = 'public, max-age=3600'
@changes = Change.all
render :changes
end
end
class ChangelogN
def get(id)
+ @headers['Cache-Control'] = 'public, max-age=3600'
@change = Change.new(id)
case @change.type
when :entry
@@ -84,6 +87,7 @@ def get
class Entry < R '/(.+?)'
def get(name)
+ @headers['Cache-Control'] = 'public, max-age=3600'
@entry = Models::Entry.new(name)
if @entry.file?

0 comments on commit 6e96a3f

Please sign in to comment.