[
https://issues.apache.org/jira/browse/WW-5355?focusedWorklogId=885554&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-885554
]
ASF GitHub Bot logged work on WW-5355:
--------------------------------------
Author: ASF GitHub Bot
Created on: 17/Oct/23 08:09
Start Date: 17/Oct/23 08:09
Worklog Time Spent: 10m
Work Description: lukaszlenart commented on code in PR #766:
URL: https://github.com/apache/struts/pull/766#discussion_r1361697311
##########
core/src/main/java/com/opensymphony/xwork2/ognl/OgnlCacheFactory.java:
##########
@@ -19,12 +19,52 @@
* Used by {@link com.opensymphony.xwork2.ognl.OgnlUtil} to create appropriate
OGNL
* caches based on configuration.
*
- * @param <Key> The type for the cache key entries
+ * @param <Key> The type for the cache key entries
* @param <Value> The type for the cache value entries
*/
-interface OgnlCacheFactory<Key, Value> {
+public interface OgnlCacheFactory<Key, Value> {
OgnlCache<Key, Value> buildOgnlCache();
- OgnlCache<Key, Value> buildOgnlCache(int evictionLimit, int
initialCapacity, float loadFactor, boolean lruCache);
+
+ /**
+ * Note that if {@code lruCache} is {@code false}, the cache type could
still be LRU if the default cache type is
+ * configured as such.
+ * @deprecated since 6.4.0, use {@link #buildOgnlCache(int, int, float,
CacheType)}
+ */
+ @Deprecated
+ default OgnlCache<Key, Value> buildOgnlCache(int evictionLimit,
+ int initialCapacity,
+ float loadFactor,
+ boolean lruCache) {
+ return buildOgnlCache(evictionLimit,
+ initialCapacity,
+ loadFactor,
+ lruCache ? CacheType.SYNC_LINKED_LRU : getDefaultCacheType());
+ }
+
+ /**
+ * @param evictionLimit maximum capacity of the cache where applicable
for cache type chosen
+ * @param initialCapacity initial capacity of the cache where applicable
for cache type chosen
+ * @param loadFactor load factor of the cache where applicable for
cache type chosen
+ * @param cacheType type of cache to build
+ * @return a new cache instance
+ */
+ OgnlCache<Key, Value> buildOgnlCache(int evictionLimit, int
initialCapacity, float loadFactor, CacheType cacheType);
+
int getCacheMaxSize();
- boolean getUseLRUCache();
+
+ /**
+ * @deprecated since 6.4.0
+ */
+ @Deprecated
+ default boolean getUseLRUCache() {
+ return CacheType.SYNC_LINKED_LRU.equals(getDefaultCacheType());
+ }
+
+ CacheType getDefaultCacheType();
+
+ enum CacheType {
+ CONCURRENT_BASIC,
+ SYNC_LINKED_LRU,
+ CAFFEINE_WTLFU
Review Comment:
Thanks! That would make more sense and then we can remove all the properties
and leave that to a given implementation. Please create the ticket :)
Issue Time Tracking
-------------------
Worklog Id: (was: 885554)
Time Spent: 6h 50m (was: 6h 40m)
> Use LRU cache by default
> ------------------------
>
> Key: WW-5355
> URL: https://issues.apache.org/jira/browse/WW-5355
> Project: Struts 2
> Issue Type: Improvement
> Components: Core
> Reporter: Kusal Kithul-Godage
> Priority: Minor
> Fix For: 6.4.0
>
> Time Spent: 6h 50m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)