diff --git a/translation-web/src/main/java/eu/europeana/api/translation/web/service/RedisCacheService.java b/translation-web/src/main/java/eu/europeana/api/translation/web/service/RedisCacheService.java index 7adc0773..0ae27d45 100644 --- a/translation-web/src/main/java/eu/europeana/api/translation/web/service/RedisCacheService.java +++ b/translation-web/src/main/java/eu/europeana/api/translation/web/service/RedisCacheService.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; @@ -48,8 +49,9 @@ public void saveRedisCache(String sourceLang, String targetLang, List in } public void deleteAll() { - if(redisTemplate.getConnectionFactory()!=null) { - redisTemplate.getConnectionFactory().getConnection().flushAll(); + RedisConnectionFactory connFact=redisTemplate.getConnectionFactory(); + if(connFact!=null) { + connFact.getConnection().flushAll(); } }