3535 * Immutable {@link RedisCacheConfiguration} used to customize {@link RedisCache} behavior, such as caching
3636 * {@literal null} values, computing cache key prefixes and handling binary serialization.
3737 * <p>
38- * Start with {@link RedisCacheConfiguration#defaultCacheConfig()} and customize {@link RedisCache} behavior
39- * using the builder methods, such as {@link #entryTtl(Duration)}, {@link #serializeKeysWith(SerializationPair)}
40- * and {@link #serializeValuesWith(SerializationPair)}.
38+ * Start with {@link RedisCacheConfiguration#defaultCacheConfig()} and customize {@link RedisCache} behavior using the
39+ * builder methods, such as {@link #entryTtl(Duration)}, {@link #serializeKeysWith(SerializationPair)} and
40+ * {@link #serializeValuesWith(SerializationPair)}.
4141 *
4242 * @author Christoph Strobl
4343 * @author Mark Paluch
@@ -110,14 +110,10 @@ public static RedisCacheConfiguration defaultCacheConfig(@Nullable ClassLoader c
110110
111111 registerDefaultConverters (conversionService );
112112
113- return new RedisCacheConfiguration (TtlFunction .persistent (),
114- DEFAULT_CACHE_NULL_VALUES ,
115- DEFAULT_ENABLE_TIME_TO_IDLE_EXPIRATION ,
116- DEFAULT_USE_PREFIX ,
117- CacheKeyPrefix .simple (),
113+ return new RedisCacheConfiguration (TtlFunction .persistent (), DEFAULT_CACHE_NULL_VALUES ,
114+ DEFAULT_ENABLE_TIME_TO_IDLE_EXPIRATION , DEFAULT_USE_PREFIX , CacheKeyPrefix .simple (),
118115 SerializationPair .fromSerializer (RedisSerializer .string ()),
119- SerializationPair .fromSerializer (RedisSerializer .java (classLoader )),
120- conversionService );
116+ SerializationPair .fromSerializer (RedisSerializer .java (classLoader )), conversionService );
121117 }
122118
123119 private final boolean cacheNullValues ;
@@ -189,9 +185,8 @@ DEFAULT_USE_PREFIX, cacheKeyPrefix, getKeySerializationPair(), getValueSerializa
189185 * @return new {@link RedisCacheConfiguration}.
190186 */
191187 public RedisCacheConfiguration disableCachingNullValues () {
192- return new RedisCacheConfiguration (getTtlFunction (), DO_NOT_CACHE_NULL_VALUES , isTimeToIdleEnabled (),
193- usePrefix (), getKeyPrefix (), getKeySerializationPair (), getValueSerializationPair (),
194- getConversionService ());
188+ return new RedisCacheConfiguration (getTtlFunction (), DO_NOT_CACHE_NULL_VALUES , isTimeToIdleEnabled (), usePrefix (),
189+ getKeyPrefix (), getKeySerializationPair (), getValueSerializationPair (), getConversionService ());
195190 }
196191
197192 /**
@@ -203,21 +198,22 @@ public RedisCacheConfiguration disableCachingNullValues() {
203198 */
204199 public RedisCacheConfiguration disableKeyPrefix () {
205200 return new RedisCacheConfiguration (getTtlFunction (), getAllowCacheNullValues (), isTimeToIdleEnabled (),
206- DO_NOT_USE_PREFIX , getKeyPrefix (), getKeySerializationPair (), getValueSerializationPair (), getConversionService ());
201+ DO_NOT_USE_PREFIX , getKeyPrefix (), getKeySerializationPair (), getValueSerializationPair (),
202+ getConversionService ());
207203 }
208204
209205 /**
210- * Enables {@literal time-to-idle (TTI) expiration} on {@link Cache} read operations,
211- * such as {@link Cache#get(Object)}.
206+ * Enables {@literal time-to-idle (TTI) expiration} on {@link Cache} read operations, such as
207+ * {@link Cache#get(Object)}.
212208 * <p>
213209 * Enabling this option applies the same {@link #getTtlFunction() TTL expiration policy} to {@link Cache} read
214210 * operations as it does for {@link Cache} write operations. In effect, this will invoke the Redis {@literal GETEX}
215211 * command in place of {@literal GET}.
216212 * <p>
217- * Redis does not support the concept of {@literal TTI}, only {@literal TTL}. However, if {@literal TTL} expiration
218- * is applied to all {@link Cache} operations, both read and write alike, and {@link Cache} operations passed with
219- * expiration are used consistently across the application, then in effect, an application can achieve
220- * {@literal TTI} expiration-like behavior.
213+ * Redis does not support the concept of {@literal TTI}, only {@literal TTL}. However, if {@literal TTL} expiration is
214+ * applied to all {@link Cache} operations, both read and write alike, and {@link Cache} operations passed with
215+ * expiration are used consistently across the application, then in effect, an application can achieve {@literal TTI}
216+ * expiration-like behavior.
221217 * <p>
222218 * Requires Redis 6.2.0 or newer.
223219 *
@@ -227,8 +223,7 @@ public RedisCacheConfiguration disableKeyPrefix() {
227223 */
228224 public RedisCacheConfiguration enableTimeToIdle () {
229225 return new RedisCacheConfiguration (getTtlFunction (), getAllowCacheNullValues (), USE_TIME_TO_IDLE_EXPIRATION ,
230- usePrefix (), getKeyPrefix (), getKeySerializationPair (), getValueSerializationPair (),
231- getConversionService ());
226+ usePrefix (), getKeyPrefix (), getKeySerializationPair (), getValueSerializationPair (), getConversionService ());
232227 }
233228
234229 /**
@@ -256,9 +251,8 @@ public RedisCacheConfiguration entryTtl(TtlFunction ttlFunction) {
256251
257252 Assert .notNull (ttlFunction , "TtlFunction must not be null" );
258253
259- return new RedisCacheConfiguration (ttlFunction , getAllowCacheNullValues (), isTimeToIdleEnabled (),
260- usePrefix (), getKeyPrefix (), getKeySerializationPair (), getValueSerializationPair (),
261- getConversionService ());
254+ return new RedisCacheConfiguration (ttlFunction , getAllowCacheNullValues (), isTimeToIdleEnabled (), usePrefix (),
255+ getKeyPrefix (), getKeySerializationPair (), getValueSerializationPair (), getConversionService ());
262256 }
263257
264258 /**
@@ -271,8 +265,8 @@ public RedisCacheConfiguration serializeKeysWith(SerializationPair<String> keySe
271265
272266 Assert .notNull (keySerializationPair , "KeySerializationPair must not be null" );
273267
274- return new RedisCacheConfiguration (getTtlFunction (), getAllowCacheNullValues (), isTimeToIdleEnabled (),
275- usePrefix (), getKeyPrefix (), keySerializationPair , getValueSerializationPair (), getConversionService ());
268+ return new RedisCacheConfiguration (getTtlFunction (), getAllowCacheNullValues (), isTimeToIdleEnabled (), usePrefix (),
269+ getKeyPrefix (), keySerializationPair , getValueSerializationPair (), getConversionService ());
276270 }
277271
278272 /**
@@ -285,8 +279,8 @@ public RedisCacheConfiguration serializeValuesWith(SerializationPair<?> valueSer
285279
286280 Assert .notNull (valueSerializationPair , "ValueSerializationPair must not be null" );
287281
288- return new RedisCacheConfiguration (getTtlFunction (), getAllowCacheNullValues (), isTimeToIdleEnabled (),
289- usePrefix (), getKeyPrefix (), getKeySerializationPair (), valueSerializationPair , getConversionService ());
282+ return new RedisCacheConfiguration (getTtlFunction (), getAllowCacheNullValues (), isTimeToIdleEnabled (), usePrefix (),
283+ getKeyPrefix (), getKeySerializationPair (), valueSerializationPair , getConversionService ());
290284 }
291285
292286 /**
@@ -299,8 +293,8 @@ public RedisCacheConfiguration withConversionService(ConversionService conversio
299293
300294 Assert .notNull (conversionService , "ConversionService must not be null" );
301295
302- return new RedisCacheConfiguration (getTtlFunction (), getAllowCacheNullValues (), isTimeToIdleEnabled (),
303- usePrefix (), getKeyPrefix (), getKeySerializationPair (), getValueSerializationPair (), conversionService );
296+ return new RedisCacheConfiguration (getTtlFunction (), getAllowCacheNullValues (), isTimeToIdleEnabled (), usePrefix (),
297+ getKeyPrefix (), getKeySerializationPair (), getValueSerializationPair (), conversionService );
304298 }
305299
306300 /**
@@ -316,7 +310,7 @@ public boolean getAllowCacheNullValues() {
316310 * Use {@link #enableTimeToIdle()} to opt-in and enable {@literal time-to-idle (TTI) expiration} for caching.
317311 *
318312 * @return {@literal true} if {@literal time-to-idle (TTI) expiration} was configured and enabled for caching.
319- * Defaults to {@literal false}.
313+ * Defaults to {@literal false}.
320314 * @see <a href="https://redis.io/commands/getex/">GETEX</a>
321315 * @since 3.2.0
322316 */
@@ -385,8 +379,8 @@ public TtlFunction getTtlFunction() {
385379 }
386380
387381 /**
388- * Adds a {@link Converter} to extract the {@link String} representation of a {@literal cache key}
389- * if no suitable {@link Object#toString()} method is present.
382+ * Adds a {@link Converter} to extract the {@link String} representation of a {@literal cache key} if no suitable
383+ * {@link Object#toString()} method is present.
390384 *
391385 * @param cacheKeyConverter {@link Converter} used to convert a {@literal cache key} into a {@link String}.
392386 * @throws IllegalStateException if {@link #getConversionService()} does not allow {@link Converter} registration.
@@ -400,8 +394,8 @@ public void addCacheKeyConverter(Converter<?, String> cacheKeyConverter) {
400394 /**
401395 * Configure the underlying {@link ConversionService} used to extract the {@literal cache key}.
402396 *
403- * @param registryConsumer {@link Consumer} used to register a {@link Converter}
404- * with the configured {@link ConverterRegistry}; never {@literal null}.
397+ * @param registryConsumer {@link Consumer} used to register a {@link Converter} with the configured
398+ * {@link ConverterRegistry}; never {@literal null}.
405399 * @throws IllegalStateException if {@link #getConversionService()} does not allow {@link Converter} registration.
406400 * @see org.springframework.core.convert.converter.ConverterRegistry
407401 * @since 2.2
0 commit comments