Skip to content
Browse files

Fixed #1232 - Cache resource lookup in production mode

The only mode that the resources are not cached is DevMode
  • Loading branch information...
1 parent 908fea7 commit 51466b12be555027a56acb6601c835d3b7fc51f3 @fmpwizard fmpwizard committed Oct 13, 2012
Showing with 9 additions and 1 deletion.
  1. +9 −1 web/webkit/src/main/scala/net/liftweb/http/S.scala
View
10 web/webkit/src/main/scala/net/liftweb/http/S.scala
@@ -933,10 +933,18 @@ trait S extends HasParams with Loggable {
* If you do not define an entry for a particular key, we fall back to using
* Lift's core entries.
*
+ * We cache the values in modes other than DevMode
+ *
* @see LiftRules.resourceNames
* @see LiftRules.resourceBundleFactories
*/
- def resourceBundles: List[ResourceBundle] = resourceBundles(locale) ++ liftCoreResourceBundle.toList
+ def _resourceBundles: List[ResourceBundle] = resourceBundles(locale) ++ liftCoreResourceBundle.toList
+
+ private lazy val cachedResourceBundles = _resourceBundles
+
+ private def resourceBundles: List[ResourceBundle] =
+ if (Props.devMode) _resourceBundles else cachedResourceBundles
+
def resourceBundles(loc: Locale): List[ResourceBundle] = {
_resBundle.box match {

0 comments on commit 51466b1

Please sign in to comment.
Something went wrong with that request. Please try again.