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: #247.
This commit is contained in:
Christoph Strobl
2017-04-18 15:21:47 +02:00
committed by Mark Paluch
parent 016af63dd4
commit c636400104
48 changed files with 13183 additions and 9203 deletions

View File

@@ -171,7 +171,7 @@ public class JedisConnectionUnitTestSuite {
doReturn(new ScanResult<String>("0", Collections.<String> emptyList())).when(jedisSpy).scan(anyString(),
any(ScanParams.class));
connection.scan();
connection.scan(ScanOptions.NONE);
verify(jedisSpy, never()).quit();
}
@@ -182,7 +182,7 @@ public class JedisConnectionUnitTestSuite {
doReturn(new ScanResult<String>("0", Collections.<String> emptyList())).when(jedisSpy).scan(anyString(),
any(ScanParams.class));
Cursor<byte[]> cursor = connection.scan();
Cursor<byte[]> cursor = connection.scan(ScanOptions.NONE);
cursor.close();
verify(jedisSpy, times(1)).quit();