Skip to content

Instantly share code, notes, and snippets.

@villemt
villemt / gist:4317583
Created December 17, 2012 11:25
Play Framework 2.0, action caching, not in dev mode
object ProductionCached {
def apply[A](key: String, duration: Int)(action: Action[A]): Action[A] = {
if (play.Play.isTest || play.Play.isDev)
action
else
Cached(_ => key, duration)(action)
}
}