Skip to content

Commit 4248545

Browse files
mp911dechristophstrobl
authored andcommitted
Polishing.
Convert internal types to records and fix a typo. Original Pull Request: #3243
1 parent 9f069e5 commit 4248545

File tree

3 files changed

+5
-20
lines changed

3 files changed

+5
-20
lines changed

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

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,7 @@ public long cleanCache(RedisConnection connection, String name, byte[] pattern)
9898
/**
9999
* {@link BatchStrategy} using {@code SCAN}.
100100
*/
101-
static class Scan implements BatchStrategy {
102-
103-
final int batchSize;
104-
105-
Scan(int batchSize) {
106-
this.batchSize = batchSize;
107-
}
101+
record Scan(int batchSize) implements BatchStrategy {
108102

109103
@Override
110104
public long cleanCache(RedisConnection connection, String name, byte[] pattern) {
@@ -138,16 +132,7 @@ public long cleanCache(RedisConnection connection, String name, byte[] pattern)
138132
*
139133
* @param <T>
140134
*/
141-
static class PartitionIterator<T> implements Iterator<List<T>> {
142-
143-
private final Iterator<T> iterator;
144-
private final int size;
145-
146-
PartitionIterator(Iterator<T> iterator, int size) {
147-
148-
this.iterator = iterator;
149-
this.size = size;
150-
}
135+
record PartitionIterator<T>(Iterator<T> iterator, int size) implements Iterator<List<T>> {
151136

152137
@Override
153138
public boolean hasNext() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ class AsynchronousCacheWriterDelegate implements AsyncCacheWriter {
704704
private final int cleanBatchSize;
705705

706706
public AsynchronousCacheWriterDelegate() {
707-
this.cleanBatchSize = batchStrategy instanceof BatchStrategies.Scan scan ? scan.batchSize
707+
this.cleanBatchSize = batchStrategy instanceof BatchStrategies.Scan scan ? scan.batchSize()
708708
: DEFAULT_SCAN_BATCH_SIZE;
709709
}
710710

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,9 +493,9 @@ static TtlFunction just(Duration duration) {
493493
}
494494

495495
/**
496-
* Returns a {@link TtlFunction} to create persistent entires that do not expire.
496+
* Returns a {@link TtlFunction} to create persistent entries that do not expire.
497497
*
498-
* @return a {@link TtlFunction} to create persistent entires that do not expire.
498+
* @return a {@link TtlFunction} to create persistent entries that do not expire.
499499
*/
500500
static TtlFunction persistent() {
501501
return just(NO_EXPIRATION);

0 commit comments

Comments
 (0)