Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #1232 - Cache resource lookup in production mode

The only mode that the resources are not cached is DevMode
  • Loading branch information...
commit 275a158a56a399905b3972b7168f9280ae19bb2f 1 parent c34f07b
@fmpwizard fmpwizard authored
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 {
Please sign in to comment.
Something went wrong with that request. Please try again.