Skip to content

Commit c636400

Browse files
christophstroblmp911de
authored andcommitted
DATAREDIS-626 - Refactor RedisConnection implementations to Redis feature-specific interfaces.
We refactored JedisConnection and LettuceConnection from monolithic connection classes into modular classes that organize methods according the Redis feature group and created segregated interfaces per Redis feature group. Segregated interfaces reduce the number of methods available on the interface to the used data type. This refactoring reduces the responsibility of JedisConnection/LettuceConnection and JedisClusterConnection/LettuceClusterConnection to a minimum of commands. To preserve backwards-compatibility with users of the connection classes, we introduced DefaultedRedisConnection and DefaultedRedisClusterConnection to forward calls from the connection facade to the specific implementation. Deprecation of connection facade method assists migration off these methods towards using methods on the feature group interface. LettuceConnection connection = … connection.keyCommands().del(key); connection.hashCommands().hSet(key, field, value); Original pull request: spring-projects#247.
1 parent 016af63 commit c636400

File tree

48 files changed

+13322
-9342
lines changed

Some content is hidden

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

48 files changed

+13322
-9342
lines changed

src/main/java/org/springframework/data/redis/connection/AbstractRedisConnection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* @author Christoph Strobl
2828
* @since 1.4
2929
*/
30-
public abstract class AbstractRedisConnection implements RedisConnection {
30+
public abstract class AbstractRedisConnection implements DefaultedRedisConnection {
3131

3232
private RedisSentinelConfiguration sentinelConfiguration;
3333
private ConcurrentHashMap<RedisNode, RedisSentinelConnection> connectionCache = new ConcurrentHashMap<RedisNode, RedisSentinelConnection>();

src/main/java/org/springframework/data/redis/connection/DefaultStringRedisConnection.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3034,7 +3034,7 @@ public Set<byte[]> zRangeByScore(byte[] key, String min, String max, long offset
30343034

30353035
/*
30363036
* (non-Javadoc)
3037-
* @see org.springframework.data.redis.connection.HyperLogLogCommands#pfAdd(byte[], byte[][])
3037+
* @see org.springframework.data.redis.connection.RedisHyperLogLogCommands#pfAdd(byte[], byte[][])
30383038
*/
30393039
@Override
30403040
public Long pfAdd(byte[] key, byte[]... values) {
@@ -3052,7 +3052,7 @@ public Long pfAdd(String key, String... values) {
30523052

30533053
/*
30543054
* (non-Javadoc)
3055-
* @see org.springframework.data.redis.connection.HyperLogLogCommands#pfCount(byte[][])
3055+
* @see org.springframework.data.redis.connection.RedisHyperLogLogCommands#pfCount(byte[][])
30563056
*/
30573057
@Override
30583058
public Long pfCount(byte[]... keys) {
@@ -3070,7 +3070,7 @@ public Long pfCount(String... keys) {
30703070

30713071
/*
30723072
* (non-Javadoc)
3073-
* @see org.springframework.data.redis.connection.HyperLogLogCommands#pfMerge(byte[], byte[][])
3073+
* @see org.springframework.data.redis.connection.RedisHyperLogLogCommands#pfMerge(byte[], byte[][])
30743074
*/
30753075
@Override
30763076
public void pfMerge(byte[] destinationKey, byte[]... sourceKeys) {
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright 2017 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.data.redis.connection;
17+
18+
/**
19+
* @author Christoph Strobl
20+
* @since 2.0
21+
*/
22+
public interface DefaultedRedisClusterConnection extends RedisClusterConnection, DefaultedRedisConnection {
23+
24+
}

0 commit comments

Comments
 (0)