Skip to content

Commit 554e829

Browse files
committed
Polish.
Additionally, refactors and cleans up the Redis cache extension and infrastructure. Closes spring-projects#2583
1 parent 6437b81 commit 554e829

File tree

7 files changed

+807
-440
lines changed

7 files changed

+807
-440
lines changed

Diff for: src/main/java/org/springframework/data/redis/cache/CacheKeyPrefix.java

+19-10
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818
import org.springframework.util.Assert;
1919

2020
/**
21-
* {@link CacheKeyPrefix} provides a hook for creating custom prefixes prepended to the actual {@literal key} stored in
22-
* Redis.
21+
* {@link CacheKeyPrefix} is a callback hook for creating custom prefixes prepended to the actual {@literal key}
22+
* stored in Redis.
2323
*
2424
* @author Christoph Strobl
2525
* @author Mark Paluch
26+
* @author John Blum
2627
* @since 2.0.4
2728
*/
2829
@FunctionalInterface
@@ -36,16 +37,20 @@ public interface CacheKeyPrefix {
3637
String SEPARATOR = "::";
3738

3839
/**
39-
* Compute the prefix for the actual {@literal key} stored in Redis.
40+
* Compute the {@link String prefix} for the actual {@literal cache key} stored in Redis.
4041
*
41-
* @param cacheName will never be {@literal null}.
42-
* @return never {@literal null}.
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}.
4346
*/
4447
String compute(String cacheName);
4548

4649
/**
47-
* Creates a default {@link CacheKeyPrefix} scheme that prefixes cache keys with {@code cacheName} followed by double
48-
* colons. A cache named {@code myCache} will prefix all cache keys with {@code myCache::}.
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::}.
4954
*
5055
* @return the default {@link CacheKeyPrefix} scheme.
5156
*/
@@ -54,9 +59,12 @@ static CacheKeyPrefix simple() {
5459
}
5560

5661
/**
57-
* Creates a {@link CacheKeyPrefix} scheme that prefixes cache keys with the given {@code prefix}. The prefix is
58-
* prepended to the {@code cacheName} followed by double colons. A prefix {@code redis-} with a cache named
59-
* {@code myCache} results in {@code redis-myCache::}.
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::}.
6068
*
6169
* @param prefix must not be {@literal null}.
6270
* @return the default {@link CacheKeyPrefix} scheme.
@@ -65,6 +73,7 @@ static CacheKeyPrefix simple() {
6573
static CacheKeyPrefix prefixed(String prefix) {
6674

6775
Assert.notNull(prefix, "Prefix must not be null");
76+
6877
return name -> prefix + name + SEPARATOR;
6978
}
7079
}

0 commit comments

Comments
 (0)