Skip to content

Commit 07b4539

Browse files
committed
Re-apply code formatter.
Closes #3245.
1 parent eca5ac5 commit 07b4539

File tree

250 files changed

+1674
-2163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

250 files changed

+1674
-2163
lines changed

src/main/java/org/springframework/data/redis/cache/CacheKeyPrefix.java

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
import org.springframework.util.Assert;
1919

2020
/**
21-
* {@link CacheKeyPrefix} is a callback hook for creating custom prefixes prepended to the actual {@literal key}
22-
* stored in Redis.
21+
* {@link CacheKeyPrefix} is a callback hook for creating custom prefixes prepended to the actual {@literal key} stored
22+
* in Redis.
2323
*
2424
* @author Christoph Strobl
2525
* @author Mark Paluch
@@ -39,18 +39,15 @@ public interface CacheKeyPrefix {
3939
/**
4040
* Compute the {@link String prefix} for the actual {@literal cache key} stored in Redis.
4141
*
42-
* @param cacheName {@link String name} of the cache in which the key is stored;
43-
* will never be {@literal null}.
44-
* @return the computed {@link String prefix} of the {@literal cache key} stored in Redis;
45-
* never {@literal null}.
42+
* @param cacheName {@link String name} of the cache in which the key is stored; will never be {@literal null}.
43+
* @return the computed {@link String prefix} of the {@literal cache key} stored in Redis; never {@literal null}.
4644
*/
4745
String compute(String cacheName);
4846

4947
/**
50-
* Creates a default {@link CacheKeyPrefix} scheme that prefixes cache keys with the {@link String name}
51-
* of the cache followed by double colons.
52-
*
53-
* For example, a cache named {@literal myCache} will prefix all cache keys with {@literal myCache::}.
48+
* Creates a default {@link CacheKeyPrefix} scheme that prefixes cache keys with the {@link String name} of the cache
49+
* followed by double colons. For example, a cache named {@literal myCache} will prefix all cache keys with
50+
* {@literal myCache::}.
5451
*
5552
* @return the default {@link CacheKeyPrefix} scheme.
5653
*/
@@ -59,12 +56,9 @@ static CacheKeyPrefix simple() {
5956
}
6057

6158
/**
62-
* Creates a {@link CacheKeyPrefix} scheme that prefixes cache keys with the given {@link String prefix}.
63-
*
64-
* The {@link String prefix} is prepended to the {@link String cacheName} followed by double colons.
65-
*
66-
* For example, a prefix {@literal redis-} with a cache named {@literal myCache}
67-
* results in {@literal redis-myCache::}.
59+
* Creates a {@link CacheKeyPrefix} scheme that prefixes cache keys with the given {@link String prefix}. The
60+
* {@link String prefix} is prepended to the {@link String cacheName} followed by double colons. For example, a prefix
61+
* {@literal redis-} with a cache named {@literal myCache} results in {@literal redis-myCache::}.
6862
*
6963
* @param prefix must not be {@literal null}.
7064
* @return the default {@link CacheKeyPrefix} scheme.

src/main/java/org/springframework/data/redis/cache/DefaultRedisCacheWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class DefaultRedisCacheWriter implements RedisCacheWriter {
143143
}
144144

145145
@SuppressWarnings("NullAway")
146-
private byte @Nullable[] doGet(RedisConnection connection, String name, byte[] key, @Nullable Duration ttl) {
146+
private byte @Nullable [] doGet(RedisConnection connection, String name, byte[] key, @Nullable Duration ttl) {
147147

148148
RedisStringCommands commands = connection.stringCommands();
149149
byte[] result = shouldExpireWithin(ttl) ? commands.getEx(key, Expiration.from(ttl)) : commands.get(key);

src/main/java/org/springframework/data/redis/cache/RedisCache.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
@SuppressWarnings("unused")
5858
public class RedisCache extends AbstractValueAdaptingCache {
5959

60-
@SuppressWarnings("NullAway")
61-
static final byte[] BINARY_NULL_VALUE = RedisSerializer.java().serialize(NullValue.INSTANCE);
60+
@SuppressWarnings("NullAway") static final byte[] BINARY_NULL_VALUE = RedisSerializer.java()
61+
.serialize(NullValue.INSTANCE);
6262

6363
static final String CACHE_RETRIEVAL_UNSUPPORTED_OPERATION_EXCEPTION_MESSAGE = "The Redis driver configured with RedisCache through RedisCacheWriter does not support CompletableFuture-based retrieval";
6464

@@ -271,7 +271,7 @@ public CompletableFuture<ValueWrapper> retrieve(Object key) {
271271
}
272272

273273
@Override
274-
@SuppressWarnings({"unchecked", "NullAway"})
274+
@SuppressWarnings({ "unchecked", "NullAway" })
275275
public <T> CompletableFuture<T> retrieve(Object key, Supplier<CompletableFuture<T>> valueLoader) {
276276

277277
return retrieve(key).thenCompose(wrapper -> {
@@ -427,7 +427,7 @@ private CompletableFuture<ValueWrapper> retrieveValue(Object key) {
427427
.thenApply(this::toValueWrapper);
428428
}
429429

430-
private @Nullable Object nullSafeDeserializedStoreValue(byte @Nullable[] value) {
430+
private @Nullable Object nullSafeDeserializedStoreValue(byte @Nullable [] value) {
431431
return value != null ? fromStoreValue(deserializeCacheValue(value)) : null;
432432
}
433433

src/main/java/org/springframework/data/redis/cache/RedisCacheConfiguration.java

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
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

Comments
 (0)