lukaszlenart commented on code in PR #183: URL: https://github.com/apache/struts-site/pull/183#discussion_r1083710358
########## source/core-developers/ognl-cache-configuration.md: ########## @@ -0,0 +1,90 @@ +--- +layout: core-developers +title: OGNL Cache Configuration +--- + +# OGNL Cache Configuration + +The Struts framework provides two different OGNL caches, an expression cache and a BeanInfo cache. +Developers may set properties in [struts.xml](struts-xml) and/or [default.properties](default-properties) to +configure certain behaviours for the OGNL caches. The properties that can be set vary between Struts +versions, referring to the configuration files in a given version should provide guidance in that respect. + +The OGNL expression cache is enabled by default. Developers can toggle that state via default.properties: +``` +struts.ognl.enableExpressionCache=true +``` +or +``` +struts.ognl.enableExpressionCache=false +``` +The same toggle is also available via struts.xml: +``` +<constant name="struts.ognl.enableExpressionCache" value="true"/> +``` +or +``` +<constant name="struts.ognl.enableExpressionCache" value="false"/> +``` + +Disabling the OGNL expression cache can have a negative impact on performance, but +disabling the cache can limit memory overhead for the application (a trade-off). + +As of Struts 2.6, additional configuration properties have been made available to control the Review Comment: Could you use "6.0.0" term? ########## source/core-developers/ognl-cache-configuration.md: ########## @@ -0,0 +1,90 @@ +--- +layout: core-developers +title: OGNL Cache Configuration +--- + +# OGNL Cache Configuration + +The Struts framework provides two different OGNL caches, an expression cache and a BeanInfo cache. +Developers may set properties in [struts.xml](struts-xml) and/or [default.properties](default-properties) to +configure certain behaviours for the OGNL caches. The properties that can be set vary between Struts +versions, referring to the configuration files in a given version should provide guidance in that respect. + +The OGNL expression cache is enabled by default. Developers can toggle that state via default.properties: +``` +struts.ognl.enableExpressionCache=true +``` +or +``` +struts.ognl.enableExpressionCache=false +``` +The same toggle is also available via struts.xml: +``` +<constant name="struts.ognl.enableExpressionCache" value="true"/> +``` +or +``` +<constant name="struts.ognl.enableExpressionCache" value="false"/> +``` + +Disabling the OGNL expression cache can have a negative impact on performance, but +disabling the cache can limit memory overhead for the application (a trade-off). + +As of Struts 2.6, additional configuration properties have been made available to control the +OGNL cache configuration. These include a configureable cache size limit, and activating +an LRU (Least Recently Used) cache mode. The expression cache and BeanInfo cache can have +their properties set independently. Both caches are standard caches with a high maximum +capacity by default. The developer may override the default behaviour using the +appropriate configuration properties. + +Below are some examples of setting the cache configuration via default.properties: +``` +### Set expression and BeanInfo caches to size 1250 with standard cache mode +struts.ognl.enableExpressionCache=true +struts.ognl.expressionCacheMaxSize=1250 +struts.ognl.expressionCacheLRUMode=false +struts.ognl.beanInfoCacheMaxSize=1250 +struts.ognl.beanInfoCacheLRUMode=false +``` +``` +### Set expression and BeanInfo caches to size 1000 with LRU cache mode +struts.ognl.enableExpressionCache=true +struts.ognl.expressionCacheMaxSize=1000 +struts.ognl.expressionCacheLRUMode=true +struts.ognl.beanInfoCacheMaxSize=1000 +struts.ognl.beanInfoCacheLRUMode=true +``` + +Below are some examples of setting the cache configuration via struts.xml: +``` +<!-- Set expression and BeanInfo caches to size 1250 with standard cache mode --> +<constant name="struts.ognl.enableExpressionCache" value="true"/> +<constant name="struts.ognl.expressionCacheMaxSize" value="1250"/> +<constant name="struts.ognl.expressionCacheLRUMode" value="false"/> +<constant name="struts.ognl.beanInfoCacheMaxSize" value="1250"/> +<constant name="struts.ognl.beanInfoCacheLRUMode" value="false"/> +``` +``` +<!-- Set expression and BeanInfo caches to size 1000 with LRU cache mode --> +<constant name="struts.ognl.enableExpressionCache" value="true"/> +<constant name="struts.ognl.expressionCacheMaxSize" value="1000"/> +<constant name="struts.ognl.expressionCacheLRUMode" value="true"/> +<constant name="struts.ognl.beanInfoCacheMaxSize" value="1000"/> +<constant name="struts.ognl.beanInfoCacheLRUMode" value="true"/> +``` + +As of Struts 2.6, developers may choose to implement their own OGNL cache factories, Review Comment: Same here, please use "6.0.0" to avoid confusing users -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@struts.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org