From 8dc178eb8dc28e927eb1dbfaad5e3986bf0b093c Mon Sep 17 00:00:00 2001 From: Will Ezell Date: Wed, 30 Oct 2024 18:24:56 -0400 Subject: [PATCH 1/2] fix(cache) invalid reporting on TTL seconds for non-configured regions ref: #30528 --- .../business/cache/provider/caffine/CaffineCache.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotCMS/src/main/java/com/dotmarketing/business/cache/provider/caffine/CaffineCache.java b/dotCMS/src/main/java/com/dotmarketing/business/cache/provider/caffine/CaffineCache.java index fffacbef9db7..f26c41573ae2 100644 --- a/dotCMS/src/main/java/com/dotmarketing/business/cache/provider/caffine/CaffineCache.java +++ b/dotCMS/src/main/java/com/dotmarketing/business/cache/provider/caffine/CaffineCache.java @@ -199,7 +199,7 @@ public CacheProviderStats getStats() { : Config.getIntProperty("cache." + DEFAULT_CACHE + ".size"); final int seconds = - isDefault ? Config.getIntProperty("cache." + DEFAULT_CACHE + ".seconds", 100) + isDefault ? Config.getIntProperty("cache." + DEFAULT_CACHE + ".seconds", -1) : Config.getIntProperty("cache." + group + ".seconds", -1); com.github.benmanes.caffeine.cache.stats.CacheStats cstats = foundCache.stats(); From 2b6e6d852bebcafff1e0503b2aff9847c8119a3a Mon Sep 17 00:00:00 2001 From: Will Ezell Date: Wed, 30 Oct 2024 18:26:00 -0400 Subject: [PATCH 2/2] fix(cache) removing sync blocks as we now have the ConcurrentHashMap ref: #30528 --- .../cache/provider/timedcache/TimedCacheProvider.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dotCMS/src/main/java/com/dotmarketing/business/cache/provider/timedcache/TimedCacheProvider.java b/dotCMS/src/main/java/com/dotmarketing/business/cache/provider/timedcache/TimedCacheProvider.java index 0a889a2c0c91..cde5eef3a339 100644 --- a/dotCMS/src/main/java/com/dotmarketing/business/cache/provider/timedcache/TimedCacheProvider.java +++ b/dotCMS/src/main/java/com/dotmarketing/business/cache/provider/timedcache/TimedCacheProvider.java @@ -31,8 +31,6 @@ public class TimedCacheProvider extends CacheProvider { private final ConcurrentHashMap> groups = new ConcurrentHashMap<>(); static final String DEFAULT_CACHE = CacheProviderAPI.DEFAULT_CACHE; - static final String LIVE_CACHE_PREFIX = CacheProviderAPI.LIVE_CACHE_PREFIX; - static final String WORKING_CACHE_PREFIX = CacheProviderAPI.WORKING_CACHE_PREFIX; private final HashSet availableCaches = new HashSet<>(); @@ -94,7 +92,7 @@ public void put(String group, String key, Object content) { } @Override - public synchronized Object get(String group, String key) { + public Object get(String group, String key) { // Get the cache for the given group Cache cache = getCache(group); return cache.getIfPresent(key); @@ -204,7 +202,7 @@ private String cacheKey(String group, String key) { return (group + ":" + key).toLowerCase(); } - private synchronized Cache getCache(String cacheName) { + private Cache getCache(String cacheName) { if (cacheName == null) { throw new DotStateException("Null cache region passed in"); } @@ -265,4 +263,4 @@ private synchronized Cache getCache(String cacheName) { -} \ No newline at end of file +}