You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by ku...@apache.org on 2023/10/17 03:17:42 UTC

[struts] 01/02: WW-5355 Rename cache types

This is an automated email from the ASF dual-hosted git repository.

kusal pushed a commit to branch WW-5355-cache-lru
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 7cded18c0946e39eaeb3629f861a7caefcee6bcc
Author: Kusal Kithul-Godage <gi...@kusal.io>
AuthorDate: Tue Oct 17 14:16:14 2023 +1100

    WW-5355 Rename cache types
---
 .../com/opensymphony/xwork2/ognl/DefaultOgnlCacheFactory.java  |  8 ++++----
 .../java/com/opensymphony/xwork2/ognl/OgnlCacheFactory.java    | 10 +++++-----
 core/src/main/resources/org/apache/struts2/default.properties  |  4 ++--
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/core/src/main/java/com/opensymphony/xwork2/ognl/DefaultOgnlCacheFactory.java b/core/src/main/java/com/opensymphony/xwork2/ognl/DefaultOgnlCacheFactory.java
index fc3cd016f..e25334c50 100644
--- a/core/src/main/java/com/opensymphony/xwork2/ognl/DefaultOgnlCacheFactory.java
+++ b/core/src/main/java/com/opensymphony/xwork2/ognl/DefaultOgnlCacheFactory.java
@@ -57,11 +57,11 @@ public class DefaultOgnlCacheFactory<Key, Value> implements OgnlCacheFactory<Key
                                                 float loadFactor,
                                                 CacheType cacheType) {
         switch (cacheType) {
-            case CONCURRENT_BASIC:
+            case BASIC:
                 return new OgnlDefaultCache<>(evictionLimit, initialCapacity, loadFactor);
-            case SYNC_LINKED_LRU:
+            case LRU:
                 return new OgnlLRUCache<>(evictionLimit, initialCapacity, loadFactor);
-            case CAFFEINE_WTLFU:
+            case WTLFU:
                 return new OgnlCaffeineCache<>(evictionLimit, initialCapacity);
             default:
                 throw new IllegalArgumentException("Unknown cache type: " + cacheType);
@@ -94,7 +94,7 @@ public class DefaultOgnlCacheFactory<Key, Value> implements OgnlCacheFactory<Key
     @Deprecated
     protected void setUseLRUCache(String useLRUMode) {
         if (BooleanUtils.toBoolean(useLRUMode)) {
-            defaultCacheType = CacheType.SYNC_LINKED_LRU;
+            defaultCacheType = CacheType.LRU;
         }
     }
 }
diff --git a/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlCacheFactory.java b/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlCacheFactory.java
index ead1aea84..874bf4a2e 100644
--- a/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlCacheFactory.java
+++ b/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlCacheFactory.java
@@ -38,7 +38,7 @@ public interface OgnlCacheFactory<Key, Value> {
         return buildOgnlCache(evictionLimit,
                 initialCapacity,
                 loadFactor,
-                lruCache ? CacheType.SYNC_LINKED_LRU : getDefaultCacheType());
+                lruCache ? CacheType.LRU : getDefaultCacheType());
     }
 
     /**
@@ -57,14 +57,14 @@ public interface OgnlCacheFactory<Key, Value> {
      */
     @Deprecated
     default boolean getUseLRUCache() {
-        return CacheType.SYNC_LINKED_LRU.equals(getDefaultCacheType());
+        return CacheType.LRU.equals(getDefaultCacheType());
     }
 
     CacheType getDefaultCacheType();
 
     enum CacheType {
-        CONCURRENT_BASIC,
-        SYNC_LINKED_LRU,
-        CAFFEINE_WTLFU
+        BASIC,
+        LRU,
+        WTLFU
     }
 }
diff --git a/core/src/main/resources/org/apache/struts2/default.properties b/core/src/main/resources/org/apache/struts2/default.properties
index 13d99b4ea..6b3cb4dfe 100644
--- a/core/src/main/resources/org/apache/struts2/default.properties
+++ b/core/src/main/resources/org/apache/struts2/default.properties
@@ -238,14 +238,14 @@ struts.ognl.enableExpressionCache=true
 # struts.ognl.beanInfoCacheFactory=customOgnlBeanInfoCacheFactory
 
 ### Specifies the type of cache to use for parsed OGNL expressions. See StrutsConstants class for further information.
-struts.ognl.expressionCacheType=caffeine_wtlfu
+struts.ognl.expressionCacheType=wtlfu
 
 ### Specifies the maximum cache size for parsed OGNL expressions. This should be configured based on the cache type
 ### chosen and application-specific needs.
 struts.ognl.expressionCacheMaxSize=10000
 
 ### Specifies the type of cache to use for BeanInfo objects. See StrutsConstants class for further information.
-struts.ognl.beanInfoCacheType=caffeine_wtlfu
+struts.ognl.beanInfoCacheType=wtlfu
 
 ### Specifies the maximum cache size for BeanInfo objects. This should be configured based on the cache type chosen and
 ### application-specific needs.