Permalink
Browse files

http chache for battles and live pages

  • Loading branch information...
1 parent 44ed379 commit 4291478b1de836158895c7d2c940f2c2d0017380 @dalkvist committed Mar 27, 2013
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/bf3/core.clj
View
@@ -513,6 +513,18 @@
[:small "Inspired by " (link-to "https://stalkdice.ep.io/" "stalk dice")]
))
+(defn cache-battles
+ [handler]
+ (fn [request]
+ (let [resp (handler request)]
+ (if (= (:uri request) "/gc/battles")
+ (assoc-in resp [:headers "Cache-Control"] "max-age=60")
+ (if (re-find #"^/live/" (:uri request))
+ (assoc-in resp [:headers "Cache-Control"] "max-age=10")
+ resp)))))
+
+(server/add-middleware cache-battles)
+
(defonce server (atom nil))
(defn -main [& m]

0 comments on commit 4291478

Please sign in to comment.