Align ConcurrentMapCacheManager locking behavior with CaffeineCacheManager

Closes gh-30780
This commit is contained in:
Juergen Hoeller
2023-06-30 10:39:53 +02:00
parent 0c39fff831
commit 60865eae4b
2 changed files with 6 additions and 14 deletions

View File

@@ -189,13 +189,11 @@ public class CaffeineCacheManager implements CacheManager {
@Override
@Nullable
public Cache getCache(String name) {
if (this.dynamic) {
Cache cache = this.cacheMap.get(name);
return (cache != null) ? cache : this.cacheMap.computeIfAbsent(name, this::createCaffeineCache);
}
else {
return this.cacheMap.get(name);
Cache cache = this.cacheMap.get(name);
if (cache == null && this.dynamic) {
cache = this.cacheMap.computeIfAbsent(name, this::createCaffeineCache);
}
return cache;
}