Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DATAREDIS-1151 - change clean method keys command to scan #2904

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public interface RedisCacheWriter extends CacheStatisticsProvider {
* @return new instance of {@link DefaultRedisCacheWriter}.
*/
static RedisCacheWriter nonLockingRedisCacheWriter(RedisConnectionFactory connectionFactory) {
return nonLockingRedisCacheWriter(connectionFactory, BatchStrategies.keys());
return nonLockingRedisCacheWriter(connectionFactory, BatchStrategies.scan(10));
}

/**
Expand All @@ -74,7 +74,7 @@ static RedisCacheWriter nonLockingRedisCacheWriter(RedisConnectionFactory connec
* @return new instance of {@link DefaultRedisCacheWriter}.
*/
static RedisCacheWriter lockingRedisCacheWriter(RedisConnectionFactory connectionFactory) {
return lockingRedisCacheWriter(connectionFactory, BatchStrategies.keys());
return lockingRedisCacheWriter(connectionFactory, BatchStrategies.scan(10));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import static org.assertj.core.api.Assertions.*;
import static org.springframework.data.redis.cache.RedisCacheWriter.*;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.ArrayList;
Expand Down Expand Up @@ -268,7 +267,7 @@ void cleanShouldRemoveAllKeysByPattern() {
RedisCacheWriter writer = nonLockingRedisCacheWriter(connectionFactory)
.withStatisticsCollector(CacheStatisticsCollector.create());

writer.clean(CACHE_NAME, (CACHE_NAME + "::*").getBytes(Charset.forName("UTF-8")));
writer.clean(CACHE_NAME, (CACHE_NAME + "::*").getBytes(StandardCharsets.UTF_8));

doWithConnection(connection -> {
assertThat(connection.exists(binaryCacheKey)).isFalse();
Expand Down
Loading