From a9b2514620a6e4f1fb1377936423c2527800400c Mon Sep 17 00:00:00 2001 From: Steven Winship Date: Wed, 20 Mar 2024 15:54:03 -0400 Subject: [PATCH] add check for existing cache before creating a new one --- .../iq/dataverse/util/cache/CacheFactoryBean.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/util/cache/CacheFactoryBean.java b/src/main/java/edu/harvard/iq/dataverse/util/cache/CacheFactoryBean.java index c2781f3f4b8..36b2b35b48f 100644 --- a/src/main/java/edu/harvard/iq/dataverse/util/cache/CacheFactoryBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/util/cache/CacheFactoryBean.java @@ -32,10 +32,13 @@ public class CacheFactoryBean implements java.io.Serializable { @PostConstruct public void init() { - CompleteConfiguration config = - new MutableConfiguration() - .setTypes( String.class, String.class ); - rateLimitCache = manager.createCache(RATE_LIMIT_CACHE, config); + rateLimitCache = manager.getCache(RATE_LIMIT_CACHE); + if (rateLimitCache == null) { + CompleteConfiguration config = + new MutableConfiguration() + .setTypes( String.class, String.class ); + rateLimitCache = manager.createCache(RATE_LIMIT_CACHE, config); + } } /**