File tree 1 file changed +10
-9
lines changed
spring-context/src/main/java/org/springframework/cache/support
1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -87,25 +87,26 @@ public void initializeCaches() {
87
87
@ Override
88
88
@ Nullable
89
89
public Cache getCache (String name ) {
90
+ // Quick check for existing cache...
90
91
Cache cache = this .cacheMap .get (name );
91
92
if (cache != null ) {
92
93
return cache ;
93
94
}
94
- else {
95
- // Fully synchronize now for missing cache creation...
95
+
96
+ // The provider may support on-demand cache creation...
97
+ Cache missingCache = getMissingCache (name );
98
+ if (missingCache != null ) {
99
+ // Fully synchronize now for missing cache registration
96
100
synchronized (this .cacheMap ) {
97
101
cache = this .cacheMap .get (name );
98
102
if (cache == null ) {
99
- cache = getMissingCache (name );
100
- if (cache != null ) {
101
- cache = decorateCache (cache );
102
- this .cacheMap .put (name , cache );
103
- updateCacheNames (name );
104
- }
103
+ cache = decorateCache (missingCache );
104
+ this .cacheMap .put (name , cache );
105
+ updateCacheNames (name );
105
106
}
106
- return cache ;
107
107
}
108
108
}
109
+ return cache ;
109
110
}
110
111
111
112
@ Override
You can’t perform that action at this time.
0 commit comments