diff --git a/core/src/main/java/org/mskcc/cbio/oncokb/cache/CustomRedisCache.java b/core/src/main/java/org/mskcc/cbio/oncokb/cache/CustomRedisCache.java index bfb4aa77f..d56da4dea 100644 --- a/core/src/main/java/org/mskcc/cbio/oncokb/cache/CustomRedisCache.java +++ b/core/src/main/java/org/mskcc/cbio/oncokb/cache/CustomRedisCache.java @@ -9,6 +9,7 @@ import org.springframework.cache.support.SimpleValueWrapper; import java.io.*; +import java.util.concurrent.Callable; import java.util.concurrent.TimeUnit; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; @@ -168,4 +169,25 @@ protected Object fromStoreValue(Object storeValue) { protected Cache.ValueWrapper toValueWrapper(Object storeValue) { return (storeValue != null ? new SimpleValueWrapper(storeValue) : null); } + + @Override + @SuppressWarnings("unchecked") + public T get(Object key, Callable valueLoader) { + // see https://docs.spring.io/spring-framework/docs/4.3.9.RELEASE/spring-framework-reference/html/cache.html#cache-annotations-cacheable-synchronized + LOG.warn("Sync method was enabled for cacheable. We do not currently support synchronized caching, so this is most likely a mistake."); + + ValueWrapper storeValue = get(key); + if (storeValue != null) { + return (T) storeValue.get(); + } + + T value; + try { + value = valueLoader.call(); + } catch (Throwable ex) { + throw new ValueRetrievalException(key, valueLoader, ex); + } + put(key, value); + return value; + } } diff --git a/pom.xml b/pom.xml index dde670c00..94e96783b 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ 1.8 UTF-8 3.6.10.Final - 4.2.2.RELEASE + 4.3.30.RELEASE 1.8 1.8