1
1
package com .github .scoquelin .arugula
2
2
3
- import com .github .scoquelin .arugula .codec .RedisCodec
4
- import com .github .scoquelin .arugula .codec .LongCodec
3
+ import com .github .scoquelin .arugula .codec .{LongCodec , RedisCodec }
5
4
import com .github .scoquelin .arugula .config .LettuceRedisClientConfig
6
- import io .lettuce .core .codec .{StringCodec => JStringCodec , RedisCodec => JRedisCodec }
5
+ import io .lettuce .core .codec .{StringCodec => JStringCodec }
7
6
8
7
import scala .concurrent .ExecutionContext
9
8
@@ -17,12 +16,12 @@ trait CachedClients {
17
16
def getClient [K , V ](codec : RedisCodec [K , V ], connectionType : RedisConnectionType ): RedisCommandsClient [K , V ]
18
17
}
19
18
20
- private class RedisCommandCachedClients (redisSingleNodeClientWithStringValue : RedisCommandsClient [String , String ],
21
- redisSingleNodeClientWithLongValue : RedisCommandsClient [String , Long ],
22
- redisClusterClientWithStringValue : RedisCommandsClient [String , String ],
23
- redisClusterClientWithLongValue : RedisCommandsClient [String , Long ]) extends CachedClients {
19
+ private class RedisCommandsCachedClients (redisSingleNodeClientWithStringValue : RedisCommandsClient [String , String ],
20
+ redisSingleNodeClientWithLongValue : RedisCommandsClient [String , Long ],
21
+ redisClusterClientWithStringValue : RedisCommandsClient [String , String ],
22
+ redisClusterClientWithLongValue : RedisCommandsClient [String , Long ]) extends CachedClients {
24
23
25
- def getClient [K , V ](codec : RedisCodec [K , V ], connectionType : RedisConnectionType ): RedisCommandsClient [K , V ] = {
24
+ override def getClient [K , V ](codec : RedisCodec [K , V ], connectionType : RedisConnectionType ): RedisCommandsClient [K , V ] = {
26
25
(codec, connectionType) match {
27
26
case (RedisCodec (JStringCodec .UTF8 ), SingleNode ) => redisSingleNodeClientWithStringValue.asInstanceOf [RedisCommandsClient [K , V ]]
28
27
case (RedisCodec (JStringCodec .UTF8 ), Cluster ) => redisClusterClientWithStringValue.asInstanceOf [RedisCommandsClient [K , V ]]
@@ -33,13 +32,13 @@ private class RedisCommandCachedClients(redisSingleNodeClientWithStringValue: Re
33
32
}
34
33
}
35
34
36
- object RedisCommandCachedClients {
35
+ object RedisCommandsCachedClients {
37
36
def apply (singleNodeConfig : LettuceRedisClientConfig , clusterConfig : LettuceRedisClientConfig )(implicit ec : ExecutionContext ): CachedClients = {
38
37
val redisSingleNodeClientWithStringValue = LettuceRedisCommandsClient (singleNodeConfig, RedisCodec .Utf8WithValueAsStringCodec )
39
38
val redisSingleNodeClientWithLongValue = LettuceRedisCommandsClient (singleNodeConfig, RedisCodec .Utf8WithValueAsLongCodec )
40
39
val redisClusterClientWithStringValue = LettuceRedisCommandsClient (clusterConfig, RedisCodec .Utf8WithValueAsStringCodec )
41
40
val redisClusterClientWithLongValue = LettuceRedisCommandsClient (clusterConfig, RedisCodec .Utf8WithValueAsLongCodec )
42
- new RedisCommandCachedClients (
41
+ new RedisCommandsCachedClients (
43
42
redisSingleNodeClientWithStringValue,
44
43
redisSingleNodeClientWithLongValue,
45
44
redisClusterClientWithStringValue,
0 commit comments