Skip to content

Commit

Permalink
WW-5355 Rename cache types
Browse files Browse the repository at this point in the history
  • Loading branch information
kusalk committed Oct 17, 2023
1 parent 9dbea66 commit 7cded18
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ public OgnlCache<Key, Value> buildOgnlCache(int evictionLimit,
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);
Expand Down Expand Up @@ -94,7 +94,7 @@ public CacheType getDefaultCacheType() {
@Deprecated
protected void setUseLRUCache(String useLRUMode) {
if (BooleanUtils.toBoolean(useLRUMode)) {
defaultCacheType = CacheType.SYNC_LINKED_LRU;
defaultCacheType = CacheType.LRU;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ default OgnlCache<Key, Value> buildOgnlCache(int evictionLimit,
return buildOgnlCache(evictionLimit,
initialCapacity,
loadFactor,
lruCache ? CacheType.SYNC_LINKED_LRU : getDefaultCacheType());
lruCache ? CacheType.LRU : getDefaultCacheType());
}

/**
Expand All @@ -57,14 +57,14 @@ default OgnlCache<Key, Value> buildOgnlCache(int evictionLimit,
*/
@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
}
}
4 changes: 2 additions & 2 deletions core/src/main/resources/org/apache/struts2/default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7cded18

Please sign in to comment.