34
34
/**
35
35
* {@link CacheManager} implementation for Redis backed by {@link RedisCache}.
36
36
* <p>
37
- * This {@link CacheManager} creates {@link Cache caches} on first write, by default. Empty {@link Cache caches} are not
38
- * visible in Redis due to how Redis represents empty data structures.
37
+ * This {@link CacheManager} creates {@link Cache caches} on first write, by default. Empty {@link Cache caches}
38
+ * are not visible in Redis due to how Redis represents empty data structures.
39
39
* <p>
40
40
* {@link Cache Caches} requiring a different {@link RedisCacheConfiguration cache configuration} than the
41
41
* {@link RedisCacheConfiguration#defaultCacheConfig() default cache configuration} can be specified via
46
46
* @author Mark Paluch
47
47
* @author Yanming Zhou
48
48
* @author John Blum
49
- * @see RedisCache
50
- * @see RedisCacheConfiguration
51
- * @see RedisCacheWriter
52
- * @see org.springframework.cache.CacheManager
49
+ * @see org.springframework.cache.transaction.AbstractTransactionSupportingCacheManager
53
50
* @see org.springframework.data.redis.connection.RedisConnectionFactory
51
+ * @see org.springframework.data.redis.cache.RedisCacheConfiguration
52
+ * @see org.springframework.data.redis.cache.RedisCacheWriter
53
+ * @see org.springframework.data.redis.cache.RedisCache
54
54
* @since 2.0
55
55
*/
56
56
public class RedisCacheManager extends AbstractTransactionSupportingCacheManager {
@@ -66,17 +66,17 @@ public class RedisCacheManager extends AbstractTransactionSupportingCacheManager
66
66
private final Map <String , RedisCacheConfiguration > initialCacheConfiguration ;
67
67
68
68
/**
69
- * Creates a new {@link RedisCacheManager} initialized with the given {@link RedisCacheWriter} and a default
69
+ * Creates a new {@link RedisCacheManager} initialized with the given {@link RedisCacheWriter} and default
70
70
* {@link RedisCacheConfiguration}.
71
71
* <p>
72
72
* Allows {@link RedisCache cache} creation at runtime.
73
73
*
74
- * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations by executing appropriate
75
- * Redis commands; must not be {@literal null}.
76
- * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches} by
77
- * default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}.
74
+ * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations
75
+ * by executing appropriate Redis commands; must not be {@literal null}.
76
+ * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches}
77
+ * by default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}.
78
78
* @throws IllegalArgumentException if either the given {@link RedisCacheWriter} or {@link RedisCacheConfiguration}
79
- * are {@literal null}.
79
+ * are {@literal null}.
80
80
* @see org.springframework.data.redis.cache.RedisCacheConfiguration
81
81
* @see org.springframework.data.redis.cache.RedisCacheWriter
82
82
*/
@@ -85,17 +85,17 @@ public RedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration d
85
85
}
86
86
87
87
/**
88
- * Creates a new {@link RedisCacheManager} initialized with the given {@link RedisCacheWriter} and default
89
- * {@link RedisCacheConfiguration}, and whether to allow cache creation at runtime.
88
+ * Creates a new {@link RedisCacheManager} initialized with the given {@link RedisCacheWriter}
89
+ * and default {@link RedisCacheConfiguration} along with whether to allow cache creation at runtime.
90
90
*
91
- * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations by executing appropriate
92
- * Redis commands; must not be {@literal null}.
93
- * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches} by
94
- * default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}.
91
+ * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations
92
+ * by executing appropriate Redis commands; must not be {@literal null}.
93
+ * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches}
94
+ * by default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}.
95
95
* @param allowRuntimeCacheCreation boolean specifying whether to allow creation of undeclared caches at runtime;
96
- * {@literal true} by default. Maybe just use {@link RedisCacheConfiguration#defaultCacheConfig()}.
96
+ * {@literal true} by default. Maybe just use {@link RedisCacheConfiguration#defaultCacheConfig()}.
97
97
* @throws IllegalArgumentException if either the given {@link RedisCacheWriter} or {@link RedisCacheConfiguration}
98
- * are {@literal null}.
98
+ * are {@literal null}.
99
99
* @see org.springframework.data.redis.cache.RedisCacheConfiguration
100
100
* @see org.springframework.data.redis.cache.RedisCacheWriter
101
101
* @since 2.0.4
@@ -113,19 +113,19 @@ private RedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration
113
113
114
114
/**
115
115
* Creates a new {@link RedisCacheManager} initialized with the given {@link RedisCacheWriter} and a default
116
- * {@link RedisCacheConfiguration}, along with an optional, initial set of {@link String cache names} used to create
117
- * {@link RedisCache Redis caches} on startup.
116
+ * {@link RedisCacheConfiguration} along with an optional, initial set of {@link String cache names}
117
+ * used to create {@link RedisCache Redis caches} on startup.
118
118
* <p>
119
119
* Allows {@link RedisCache cache} creation at runtime.
120
120
*
121
- * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations by executing appropriate
122
- * Redis commands; must not be {@literal null}.
123
- * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches} by
124
- * default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}.
121
+ * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations
122
+ * by executing appropriate Redis commands; must not be {@literal null}.
123
+ * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches}
124
+ * by default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}.
125
125
* @param initialCacheNames optional set of {@link String cache names} used to create {@link RedisCache Redis caches}
126
- * on startup. The default {@link RedisCacheConfiguration} will be applied to each cache.
126
+ * on startup. The default {@link RedisCacheConfiguration} will be applied to each cache.
127
127
* @throws IllegalArgumentException if either the given {@link RedisCacheWriter} or {@link RedisCacheConfiguration}
128
- * are {@literal null}.
128
+ * are {@literal null}.
129
129
* @see org.springframework.data.redis.cache.RedisCacheConfiguration
130
130
* @see org.springframework.data.redis.cache.RedisCacheWriter
131
131
*/
@@ -137,21 +137,21 @@ public RedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration d
137
137
138
138
/**
139
139
* Creates a new {@link RedisCacheManager} initialized with the given {@link RedisCacheWriter} and default
140
- * {@link RedisCacheConfiguration}, and whether to allow cache creation at runtime.
140
+ * {@link RedisCacheConfiguration} along with whether to allow cache creation at runtime.
141
141
* <p>
142
- * Additionally, the optional, initial set of {@link String cache names} will be used to create {@link RedisCache
143
- * Redis caches} on startup.
142
+ * Additionally, the optional, initial set of {@link String cache names} will be used to
143
+ * create {@link RedisCache Redis caches} on startup.
144
144
*
145
- * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations by executing appropriate
146
- * Redis commands; must not be {@literal null}.
147
- * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches} by
148
- * default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}.
145
+ * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations
146
+ * by executing appropriate Redis commands; must not be {@literal null}.
147
+ * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches}
148
+ * by default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}.
149
149
* @param allowRuntimeCacheCreation boolean specifying whether to allow creation of undeclared caches at runtime;
150
- * {@literal true} by default. Maybe just use {@link RedisCacheConfiguration#defaultCacheConfig()}.
150
+ * {@literal true} by default. Maybe just use {@link RedisCacheConfiguration#defaultCacheConfig()}.
151
151
* @param initialCacheNames optional set of {@link String cache names} used to create {@link RedisCache Redis caches}
152
- * on startup. The default {@link RedisCacheConfiguration} will be applied to each cache.
152
+ * on startup. The default {@link RedisCacheConfiguration} will be applied to each cache.
153
153
* @throws IllegalArgumentException if either the given {@link RedisCacheWriter} or {@link RedisCacheConfiguration}
154
- * are {@literal null}.
154
+ * are {@literal null}.
155
155
* @see org.springframework.data.redis.cache.RedisCacheConfiguration
156
156
* @see org.springframework.data.redis.cache.RedisCacheWriter
157
157
* @since 2.0.4
@@ -175,15 +175,15 @@ public RedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration d
175
175
* <p>
176
176
* Allows {@link RedisCache cache} creation at runtime.
177
177
*
178
- * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations by executing appropriate
179
- * Redis commands; must not be {@literal null}.
180
- * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches} by
181
- * default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}.
178
+ * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations
179
+ * by executing appropriate Redis commands; must not be {@literal null}.
180
+ * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches}
181
+ * by default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}.
182
182
* @param initialCacheConfigurations {@link Map} of declared, known {@link String cache names} along with associated
183
- * {@link RedisCacheConfiguration} used to create and configure {@link RedisCache Reds caches} on startup;
184
- * must not be {@literal null}.
183
+ * {@link RedisCacheConfiguration} used to create and configure {@link RedisCache Reds caches} on startup;
184
+ * must not be {@literal null}.
185
185
* @throws IllegalArgumentException if either the given {@link RedisCacheWriter} or {@link RedisCacheConfiguration}
186
- * are {@literal null}.
186
+ * are {@literal null}.
187
187
* @see org.springframework.data.redis.cache.RedisCacheConfiguration
188
188
* @see org.springframework.data.redis.cache.RedisCacheWriter
189
189
*/
@@ -200,17 +200,17 @@ public RedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration d
200
200
* Additionally, an initial {@link RedisCache} will be created and configured using the associated
201
201
* {@link RedisCacheConfiguration} for each {@link String named} {@link RedisCache} in the given {@link Map}.
202
202
*
203
- * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations by executing appropriate
204
- * Redis commands; must not be {@literal null}.
205
- * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches} by
206
- * default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}.
203
+ * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations
204
+ * by executing appropriate Redis commands; must not be {@literal null}.
205
+ * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches}
206
+ * by default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}.
207
207
* @param allowRuntimeCacheCreation boolean specifying whether to allow creation of undeclared caches at runtime;
208
- * {@literal true} by default. Maybe just use {@link RedisCacheConfiguration#defaultCacheConfig()}.
208
+ * {@literal true} by default. Maybe just use {@link RedisCacheConfiguration#defaultCacheConfig()}.
209
209
* @param initialCacheConfigurations {@link Map} of declared, known {@link String cache names} along with the
210
- * associated {@link RedisCacheConfiguration} used to create and configure {@link RedisCache Redis caches} on
211
- * startup; must not be {@literal null}.
210
+ * associated {@link RedisCacheConfiguration} used to create and configure {@link RedisCache Redis caches}
211
+ * on startup; must not be {@literal null}.
212
212
* @throws IllegalArgumentException if either the given {@link RedisCacheWriter} or {@link RedisCacheConfiguration}
213
- * are {@literal null}.
213
+ * are {@literal null}.
214
214
* @see org.springframework.data.redis.cache.RedisCacheConfiguration
215
215
* @see org.springframework.data.redis.cache.RedisCacheWriter
216
216
* @since 2.0.4
@@ -226,13 +226,12 @@ public RedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration d
226
226
}
227
227
228
228
/**
229
- * @deprecated since 3.2. Use
230
- * {@link RedisCacheManager#RedisCacheManager(RedisCacheWriter, RedisCacheConfiguration, boolean, Map)}
231
- * instead.
229
+ * @deprecated since 3.2. Use {@link RedisCacheManager#RedisCacheManager(RedisCacheWriter, RedisCacheConfiguration, boolean, Map)} instead.
232
230
*/
233
231
@ Deprecated (since = "3.2" )
234
232
public RedisCacheManager (RedisCacheWriter cacheWriter , RedisCacheConfiguration defaultCacheConfiguration ,
235
233
Map <String , RedisCacheConfiguration > initialCacheConfigurations , boolean allowRuntimeCacheCreation ) {
234
+
236
235
this (cacheWriter , defaultCacheConfiguration , allowRuntimeCacheCreation , initialCacheConfigurations );
237
236
}
238
237
@@ -250,8 +249,8 @@ public static RedisCacheManagerBuilder builder() {
250
249
* Factory method returning a {@literal Builder} used to construct and configure a {@link RedisCacheManager}
251
250
* initialized with the given {@link RedisCacheWriter}.
252
251
*
253
- * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations by executing appropriate
254
- * Redis commands; must not be {@literal null}.
252
+ * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations
253
+ * by executing appropriate Redis commands; must not be {@literal null}.
255
254
* @return new {@link RedisCacheManagerBuilder}.
256
255
* @throws IllegalArgumentException if the given {@link RedisCacheWriter} is {@literal null}.
257
256
* @see org.springframework.data.redis.cache.RedisCacheWriter
@@ -267,8 +266,8 @@ public static RedisCacheManagerBuilder builder(RedisCacheWriter cacheWriter) {
267
266
* Factory method returning a {@literal Builder} used to construct and configure a {@link RedisCacheManager}
268
267
* initialized with the given {@link RedisConnectionFactory}.
269
268
*
270
- * @param connectionFactory {@link RedisConnectionFactory} used by the {@link RedisCacheManager} to acquire
271
- * connections to Redis when performing {@link RedisCache} operations; must not be {@literal null}.
269
+ * @param connectionFactory {@link RedisConnectionFactory} used by the {@link RedisCacheManager}
270
+ * to acquire connections to Redis when performing {@link RedisCache} operations; must not be {@literal null}.
272
271
* @return new {@link RedisCacheManagerBuilder}.
273
272
* @throws IllegalArgumentException if the given {@link RedisConnectionFactory} is {@literal null}.
274
273
* @see org.springframework.data.redis.connection.RedisConnectionFactory
@@ -298,8 +297,8 @@ public static RedisCacheManagerBuilder builder(RedisConnectionFactory connection
298
297
* <dd>enabled</dd>
299
298
* </dl>
300
299
*
301
- * @param connectionFactory {@link RedisConnectionFactory} used by the {@link RedisCacheManager} to acquire
302
- * connections to Redis when performing {@link RedisCache} operations; must not be {@literal null}.
300
+ * @param connectionFactory {@link RedisConnectionFactory} used by the {@link RedisCacheManager}
301
+ * to acquire connections to Redis when performing {@link RedisCache} operations; must not be {@literal null}.
303
302
* @return new {@link RedisCacheManager}.
304
303
* @throws IllegalArgumentException if the given {@link RedisConnectionFactory} is {@literal null}.
305
304
* @see org.springframework.data.redis.connection.RedisConnectionFactory
@@ -308,9 +307,10 @@ public static RedisCacheManager create(RedisConnectionFactory connectionFactory)
308
307
309
308
Assert .notNull (connectionFactory , "ConnectionFactory must not be null" );
310
309
311
- return new RedisCacheManager (
312
- org .springframework .data .redis .cache .RedisCacheWriter .nonLockingRedisCacheWriter (connectionFactory ),
313
- RedisCacheConfiguration .defaultCacheConfig ());
310
+ RedisCacheWriter cacheWriter = RedisCacheWriter .nonLockingRedisCacheWriter (connectionFactory );
311
+ RedisCacheConfiguration cacheConfiguration = RedisCacheConfiguration .defaultCacheConfig ();
312
+
313
+ return new RedisCacheManager (cacheWriter , cacheConfiguration );
314
314
}
315
315
316
316
/**
@@ -326,8 +326,8 @@ public boolean isAllowRuntimeCacheCreation() {
326
326
* Return an {@link Collections#unmodifiableMap(Map) unmodifiable Map} containing {@link String caches name} mapped to
327
327
* the {@link RedisCache} {@link RedisCacheConfiguration configuration}.
328
328
*
329
- * @return unmodifiable {@link Map} containing {@link String cache name} / {@link RedisCacheConfiguration
330
- * configuration} pairs.
329
+ * @return unmodifiable {@link Map} containing {@link String cache name}
330
+ * / {@link RedisCacheConfiguration configuration} pairs.
331
331
*/
332
332
public Map <String , RedisCacheConfiguration > getCacheConfigurations () {
333
333
@@ -353,8 +353,8 @@ protected RedisCacheConfiguration getDefaultCacheConfiguration() {
353
353
}
354
354
355
355
/**
356
- * Gets a {@link Map} of {@link String cache names} to {@link RedisCacheConfiguration} objects as the initial set of
357
- * {@link RedisCache Redis caches} to create on startup.
356
+ * Gets a {@link Map} of {@link String cache names} to {@link RedisCacheConfiguration} objects as the initial set
357
+ * of {@link RedisCache Redis caches} to create on startup.
358
358
*
359
359
* @return a {@link Map} of {@link String cache names} to {@link RedisCacheConfiguration} objects.
360
360
*/
@@ -363,8 +363,8 @@ protected Map<String, RedisCacheConfiguration> getInitialCacheConfiguration() {
363
363
}
364
364
365
365
/**
366
- * Returns a reference to the configured {@link RedisCacheWriter} used to perform {@link RedisCache} operations, such
367
- * as reading from and writing to the cache.
366
+ * Returns a reference to the configured {@link RedisCacheWriter} used to perform {@link RedisCache} operations,
367
+ * such as reading from and writing to the cache.
368
368
*
369
369
* @return a reference to the configured {@link RedisCacheWriter}.
370
370
* @see org.springframework.data.redis.cache.RedisCacheWriter
@@ -382,8 +382,8 @@ protected RedisCache getMissingCache(String name) {
382
382
* Creates a new {@link RedisCache} with given {@link String name} and {@link RedisCacheConfiguration}.
383
383
*
384
384
* @param name {@link String name} for the {@link RedisCache}; must not be {@literal null}.
385
- * @param cacheConfiguration {@link RedisCacheConfiguration} used to configure the {@link RedisCache}; resolves to the
386
- * {@link #getDefaultCacheConfiguration()} if {@literal null}.
385
+ * @param cacheConfiguration {@link RedisCacheConfiguration} used to configure the {@link RedisCache};
386
+ * resolves to the {@link #getDefaultCacheConfiguration()} if {@literal null}.
387
387
* @return a new {@link RedisCache} instance; never {@literal null}.
388
388
*/
389
389
protected RedisCache createRedisCache (String name , @ Nullable RedisCacheConfiguration cacheConfiguration ) {
@@ -416,8 +416,8 @@ public static class RedisCacheManagerBuilder {
416
416
* Factory method returning a new {@literal Builder} used to create and configure a {@link RedisCacheManager} using
417
417
* the given {@link RedisCacheWriter}.
418
418
*
419
- * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations by executing
420
- * appropriate Redis commands; must not be {@literal null}.
419
+ * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations
420
+ * by executing appropriate Redis commands; must not be {@literal null}.
421
421
* @return new {@link RedisCacheManagerBuilder}.
422
422
* @throws IllegalArgumentException if the given {@link RedisCacheWriter} is {@literal null}.
423
423
* @see org.springframework.data.redis.cache.RedisCacheWriter
@@ -430,16 +430,17 @@ public static RedisCacheManagerBuilder fromCacheWriter(RedisCacheWriter cacheWri
430
430
* Factory method returning a new {@literal Builder} used to create and configure a {@link RedisCacheManager} using
431
431
* the given {@link RedisConnectionFactory}.
432
432
*
433
- * @param connectionFactory {@link RedisConnectionFactory} used by the {@link RedisCacheManager} to acquire
434
- * connections to Redis when performing {@link RedisCache} operations; must not be {@literal null}.
433
+ * @param connectionFactory {@link RedisConnectionFactory} used by the {@link RedisCacheManager}
434
+ * to acquire connections to Redis when performing {@link RedisCache} operations; must not be {@literal null}.
435
435
* @return new {@link RedisCacheManagerBuilder}.
436
436
* @throws IllegalArgumentException if the given {@link RedisConnectionFactory} is {@literal null}.
437
437
* @see org.springframework.data.redis.connection.RedisConnectionFactory
438
438
*/
439
439
public static RedisCacheManagerBuilder fromConnectionFactory (RedisConnectionFactory connectionFactory ) {
440
440
441
- RedisCacheWriter cacheWriter = RedisCacheWriter .nonLockingRedisCacheWriter (
442
- RedisAssertions .requireNonNull (connectionFactory , "ConnectionFactory must not be null" ));
441
+ Assert .notNull (connectionFactory , "ConnectionFactory must not be null" );
442
+
443
+ RedisCacheWriter cacheWriter = RedisCacheWriter .nonLockingRedisCacheWriter (connectionFactory );
443
444
444
445
return new RedisCacheManagerBuilder (cacheWriter );
445
446
}
@@ -464,8 +465,8 @@ private RedisCacheManagerBuilder(RedisCacheWriter cacheWriter) {
464
465
/**
465
466
* Configure whether to allow cache creation at runtime.
466
467
*
467
- * @param allowRuntimeCacheCreation boolean to allow creation of undeclared caches at runtime; {@literal true} by
468
- * default.
468
+ * @param allowRuntimeCacheCreation boolean to allow creation of undeclared caches at runtime;
469
+ * {@literal true} by default.
469
470
* @return this {@link RedisCacheManagerBuilder}.
470
471
*/
471
472
public RedisCacheManagerBuilder allowCreateOnMissingCache (boolean allowRuntimeCacheCreation ) {
@@ -476,9 +477,9 @@ public RedisCacheManagerBuilder allowCreateOnMissingCache(boolean allowRuntimeCa
476
477
/**
477
478
* Disable {@link RedisCache} creation at runtime for non-configured, undeclared caches.
478
479
* <p>
479
- * {@link RedisCacheManager#getMissingCache(String)} returns {@literal null} for any non-configured, undeclared
480
- * {@link Cache} instead of a new {@link RedisCache} instance. This allows the
481
- * {@link org.springframework.cache.support.CompositeCacheManager} to participate.
480
+ * {@link RedisCacheManager#getMissingCache(String)} returns {@literal null} for any non-configured,
481
+ * undeclared {@link Cache} instead of a new {@link RedisCache} instance.
482
+ * This allows the {@link org.springframework.cache.support.CompositeCacheManager} to participate.
482
483
*
483
484
* @return this {@link RedisCacheManagerBuilder}.
484
485
* @see #allowCreateOnMissingCache(boolean)
@@ -518,8 +519,9 @@ public RedisCacheConfiguration cacheDefaults() {
518
519
*/
519
520
public RedisCacheManagerBuilder cacheDefaults (RedisCacheConfiguration defaultCacheConfiguration ) {
520
521
521
- this .defaultCacheConfiguration = RedisAssertions .requireNonNull (defaultCacheConfiguration ,
522
- "DefaultCacheConfiguration must not be null" );
522
+ Assert .notNull (defaultCacheConfiguration , "DefaultCacheConfiguration must not be null" );
523
+
524
+ this .defaultCacheConfiguration = defaultCacheConfiguration ;
523
525
524
526
return this ;
525
527
}
@@ -573,8 +575,8 @@ public RedisCacheManagerBuilder transactionAware() {
573
575
}
574
576
575
577
/**
576
- * Registers the given {@link String cache name} and {@link RedisCacheConfiguration} used to create and configure a
577
- * {@link RedisCache} on startup.
578
+ * Registers the given {@link String cache name} and {@link RedisCacheConfiguration} used to create
579
+ * and configure a {@link RedisCache} on startup.
578
580
*
579
581
* @param cacheName {@link String name} of the cache to register for creation on startup.
580
582
* @param cacheConfiguration {@link RedisCacheConfiguration} used to configure the new cache on startup.
@@ -603,7 +605,7 @@ public RedisCacheManagerBuilder withInitialCacheConfigurations(
603
605
604
606
RedisAssertions .requireNonNull (cacheConfigurations , "CacheConfigurations must not be null" )
605
607
.forEach ((cacheName , cacheConfiguration ) -> RedisAssertions .requireNonNull (cacheConfiguration ,
606
- "RedisCacheConfiguration for cache [%s] must not be null" , cacheName ));
608
+ "RedisCacheConfiguration for cache [%s] must not be null" , cacheName ));
607
609
608
610
this .initialCaches .putAll (cacheConfigurations );
609
611
@@ -624,8 +626,8 @@ public Optional<RedisCacheConfiguration> getCacheConfigurationFor(String cacheNa
624
626
/**
625
627
* Get the {@link Set} of cache names for which the builder holds {@link RedisCacheConfiguration configuration}.
626
628
*
627
- * @return an unmodifiable {@link Set} holding the name of caches for which a {@link RedisCacheConfiguration
628
- * configuration} has been set.
629
+ * @return an unmodifiable {@link Set} holding the name of caches
630
+ * for which a {@link RedisCacheConfiguration configuration} has been set.
629
631
* @since 2.2
630
632
*/
631
633
public Set <String > getConfiguredCaches () {
0 commit comments