22using System . Collections . Generic ;
33using System . Linq ;
44using ServiceStack . Logging ;
5- using ServiceStack . Text ;
65
76namespace ServiceStack . Redis
87{
@@ -16,21 +15,15 @@ public class BasicRedisResolver : IRedisResolver, IRedisResolverExtended
1615 public int ReadOnlyHostsCount { get ; private set ; }
1716
1817 private RedisEndpoint [ ] masters ;
19- private RedisEndpoint [ ] slaves ;
18+ private RedisEndpoint [ ] replicas ;
2019
21- public RedisEndpoint [ ] Masters
22- {
23- get { return masters ; }
24- }
25- public RedisEndpoint [ ] Slaves
26- {
27- get { return slaves ; }
28- }
20+ public RedisEndpoint [ ] Masters => masters ;
21+ public RedisEndpoint [ ] Replicas => replicas ;
2922
30- public BasicRedisResolver ( IEnumerable < RedisEndpoint > masters , IEnumerable < RedisEndpoint > slaves )
23+ public BasicRedisResolver ( IEnumerable < RedisEndpoint > masters , IEnumerable < RedisEndpoint > replicas )
3124 {
3225 ResetMasters ( masters . ToList ( ) ) ;
33- ResetSlaves ( slaves . ToList ( ) ) ;
26+ ResetSlaves ( replicas . ToList ( ) ) ;
3427 ClientFactory = RedisConfig . ClientFactory ;
3528 }
3629
@@ -56,13 +49,13 @@ public virtual void ResetSlaves(IEnumerable<string> hosts)
5649 ResetSlaves ( hosts . ToRedisEndPoints ( ) ) ;
5750 }
5851
59- public virtual void ResetSlaves ( List < RedisEndpoint > newSlaves )
52+ public virtual void ResetSlaves ( List < RedisEndpoint > newReplicas )
6053 {
61- slaves = ( newSlaves ?? TypeConstants < RedisEndpoint > . EmptyList ) . ToArray ( ) ;
62- ReadOnlyHostsCount = slaves . Length ;
54+ replicas = ( newReplicas ?? TypeConstants < RedisEndpoint > . EmptyList ) . ToArray ( ) ;
55+ ReadOnlyHostsCount = replicas . Length ;
6356
6457 if ( log . IsDebugEnabled )
65- log . Debug ( "New Redis Slaves : " + string . Join ( ", " , slaves . Map ( x => x . GetHostString ( ) ) ) ) ;
58+ log . Debug ( "New Redis Replicas : " + string . Join ( ", " , replicas . Map ( x => x . GetHostString ( ) ) ) ) ;
6659 }
6760
6861 public RedisClient CreateRedisClient ( RedisEndpoint config , bool master )
@@ -78,7 +71,7 @@ public RedisEndpoint GetReadWriteHost(int desiredIndex)
7871 public RedisEndpoint GetReadOnlyHost ( int desiredIndex )
7972 {
8073 return ReadOnlyHostsCount > 0
81- ? slaves [ desiredIndex % slaves . Length ]
74+ ? replicas [ desiredIndex % replicas . Length ]
8275 : GetReadWriteHost ( desiredIndex ) ;
8376 }
8477
0 commit comments