Permalink
Browse files

Handler.Widget: cache by 1h

  • Loading branch information...
1 parent 04ed1c6 commit e80530c71b58c61963fc9c5a9369ac26a7a6f16a @astro committed Aug 28, 2012
Showing with 20 additions and 13 deletions.
  1. +20 −13 Handler/Widget.hs
View
@@ -7,6 +7,9 @@ import Data.Monoid
import Import
+
+cacheWidget = cacheSeconds $ 60 * 60
+
newtype RepJs = RepJs Content
instance HasReps RepJs where
@@ -22,22 +25,26 @@ wrapJs js = mconcat
getWidgetBaseR :: Handler RepJs
getWidgetBaseR =
- serveJs $
- fromByteString "window.torrentByEnclosure = " `mappend`
- wrapJs (fromByteString $(embedFile "templates/widget-base.js"))
+ do cacheWidget
+ serveJs $
+ fromByteString "window.torrentByEnclosure = "
+ `mappend`
+ wrapJs (fromByteString $(embedFile "templates/widget-base.js"))
getWidgetPowerpressR :: Handler RepJs
getWidgetPowerpressR =
- serveJs $
- wrapJs $
- fromByteString $(embedFile "templates/widget-base.js")
- `mappend`
- fromByteString $(embedFile "templates/widget-powerpress.js")
+ do cacheWidget
+ serveJs $
+ wrapJs $
+ fromByteString $(embedFile "templates/widget-base.js")
+ `mappend`
+ fromByteString $(embedFile "templates/widget-powerpress.js")
getWidgetPodpressR :: Handler RepJs
getWidgetPodpressR =
- serveJs $
- wrapJs $
- fromByteString $(embedFile "templates/widget-base.js")
- `mappend`
- fromByteString $(embedFile "templates/widget-podpress.js")
+ do cacheWidget
+ serveJs $
+ wrapJs $
+ fromByteString $(embedFile "templates/widget-base.js")
+ `mappend`
+ fromByteString $(embedFile "templates/widget-podpress.js")

0 comments on commit e80530c

Please sign in to comment.