Skip to content

Commit 9f2cb3e

Browse files
committed
Keep deprecated addCache method (e.g. for Spring Data Redis)
Issue: SPR-14430
1 parent 3ab86c1 commit 9f2cb3e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

spring-context/src/main/java/org/springframework/cache/support/AbstractCacheManager.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,21 @@ protected final Cache lookupCache(String name) {
128128
return this.cacheMap.get(name);
129129
}
130130

131+
/**
132+
* Dynamically register an additional Cache with this manager.
133+
* @param cache the Cache to register
134+
* @deprecated as of Spring 4.3, in favor of {@link #getMissingCache(String)}
135+
*/
136+
@Deprecated
137+
protected final void addCache(Cache cache) {
138+
String name = cache.getName();
139+
synchronized (this.cacheMap) {
140+
if (this.cacheMap.put(name, decorateCache(cache)) == null) {
141+
updateCacheNames(name);
142+
}
143+
}
144+
}
145+
131146
/**
132147
* Update the exposed {@link #cacheNames} set with the given name.
133148
* <p>This will always be called within a full {@link #cacheMap} lock

0 commit comments

Comments
 (0)