@@ -27,7 +27,7 @@ namespace ServiceStack.Redis
2727 /// <summary>
2828 /// This class contains all the common operations for the RedisClient.
2929 /// The client contains a 1:1 mapping of c# methods to redis operations of the same name.
30- ///
30+ ///
3131 /// Not threadsafe use a pooled manager
3232 /// </summary>
3333 public partial class RedisNativeClient
@@ -105,7 +105,7 @@ internal bool Active
105105 private TimeSpan retryTimeout ;
106106 public int RetryTimeout
107107 {
108- get { return ( int ) retryTimeout . TotalMilliseconds ; }
108+ get { return ( int ) retryTimeout . TotalMilliseconds ; }
109109 set { retryTimeout = TimeSpan . FromMilliseconds ( value ) ; }
110110 }
111111 public int RetryCount { get ; set ; }
@@ -897,9 +897,9 @@ public void ClientKill(string clientAddr)
897897 public long ClientKill ( string addr = null , string id = null , string type = null , string skipMe = null )
898898 {
899899 var cmdWithArgs = new List < byte [ ] >
900- {
901- Commands . Client , Commands . Kill ,
902- } ;
900+ {
901+ Commands . Client , Commands . Kill ,
902+ } ;
903903
904904 if ( addr != null )
905905 {
@@ -1258,9 +1258,9 @@ public byte[][] LRange(string listId, int startingFrom, int endingAt)
12581258 public byte [ ] [ ] Sort ( string listOrSetId , SortOptions sortOptions )
12591259 {
12601260 var cmdWithArgs = new List < byte [ ] >
1261- {
1262- Commands . Sort , listOrSetId . ToUtf8Bytes ( )
1263- } ;
1261+ {
1262+ Commands . Sort , listOrSetId . ToUtf8Bytes ( )
1263+ } ;
12641264
12651265 if ( sortOptions . SortPattern != null )
12661266 {
@@ -1702,9 +1702,9 @@ private byte[][] GetRange(byte[] commandBytes, string setId, int min, int max, b
17021702 throw new ArgumentNullException ( "setId" ) ;
17031703
17041704 var cmdWithArgs = new List < byte [ ] >
1705- {
1706- commandBytes , setId . ToUtf8Bytes ( ) , min . ToUtf8Bytes ( ) , max . ToUtf8Bytes ( )
1707- } ;
1705+ {
1706+ commandBytes , setId . ToUtf8Bytes ( ) , min . ToUtf8Bytes ( ) , max . ToUtf8Bytes ( )
1707+ } ;
17081708
17091709 if ( withScores )
17101710 {
@@ -1741,9 +1741,9 @@ private byte[][] GetRangeByScore(byte[] commandBytes,
17411741 throw new ArgumentNullException ( "setId" ) ;
17421742
17431743 var cmdWithArgs = new List < byte [ ] >
1744- {
1745- commandBytes , setId . ToUtf8Bytes ( ) , min . ToFastUtf8Bytes ( ) , max . ToFastUtf8Bytes ( )
1746- } ;
1744+ {
1745+ commandBytes , setId . ToUtf8Bytes ( ) , min . ToFastUtf8Bytes ( ) , max . ToFastUtf8Bytes ( )
1746+ } ;
17471747
17481748 if ( skip . HasValue || take . HasValue )
17491749 {
@@ -1767,9 +1767,9 @@ private byte[][] GetRangeByScore(byte[] commandBytes,
17671767 throw new ArgumentNullException ( "setId" ) ;
17681768
17691769 var cmdWithArgs = new List < byte [ ] >
1770- {
1771- commandBytes , setId . ToUtf8Bytes ( ) , min . ToUtf8Bytes ( ) , max . ToUtf8Bytes ( )
1772- } ;
1770+ {
1771+ commandBytes , setId . ToUtf8Bytes ( ) , min . ToUtf8Bytes ( ) , max . ToUtf8Bytes ( )
1772+ } ;
17731773
17741774 if ( skip . HasValue || take . HasValue )
17751775 {
@@ -1937,9 +1937,9 @@ public byte[][] ZRangeByLex(string setId, string min, string max, int? skip = nu
19371937 throw new ArgumentNullException ( "setId" ) ;
19381938
19391939 var cmdWithArgs = new List < byte [ ] >
1940- {
1941- Commands . ZRangeByLex , setId . ToUtf8Bytes ( ) , min . ToUtf8Bytes ( ) , max . ToUtf8Bytes ( )
1942- } ;
1940+ {
1941+ Commands . ZRangeByLex , setId . ToUtf8Bytes ( ) , min . ToUtf8Bytes ( ) , max . ToUtf8Bytes ( )
1942+ } ;
19431943
19441944 if ( skip . HasValue || take . HasValue )
19451945 {
@@ -2236,13 +2236,15 @@ public List<RedisGeo> GeoPos(string key, params string[] members)
22362236 break ;
22372237
22382238 var entry = data . Children [ i ] ;
2239- if ( entry . Children . Count == 0 )
2239+
2240+ var children = entry . Children ;
2241+ if ( children . Count == 0 )
22402242 continue ;
22412243
22422244 to . Add ( new RedisGeo
22432245 {
2244- Longitude = double . Parse ( entry . Children [ 0 ] . Data . FromUtf8Bytes ( ) ) ,
2245- Latitude = double . Parse ( entry . Children [ 1 ] . Data . FromUtf8Bytes ( ) ) ,
2246+ Longitude = children [ 0 ] . ToDouble ( ) ,
2247+ Latitude = children [ 1 ] . ToDouble ( ) ,
22462248 Member = members [ i ] ,
22472249 } ) ;
22482250 }
@@ -2303,16 +2305,15 @@ public List<RedisGeoResult> GeoRadius(string key, double longitude, double latit
23032305 var i = 0 ;
23042306 var result = new RedisGeoResult { Unit = unit , Member = child . Children [ i ++ ] . Data . FromUtf8Bytes ( ) } ;
23052307
2306- if ( withDist )
2307- result . Distance = double . Parse ( child . Children [ i ++ ] . Data . FromUtf8Bytes ( ) ) ;
2308+ if ( withDist ) result . Distance = child . Children [ i ++ ] . ToDouble ( ) ;
23082309
2309- if ( withHash )
2310- result . Hash = long . Parse ( child . Children [ i ++ ] . Data . FromUtf8Bytes ( ) ) ;
2310+ if ( withHash ) result . Hash = child . Children [ i ++ ] . ToInt64 ( ) ;
23112311
23122312 if ( withCoords )
23132313 {
2314- result . Longitude = double . Parse ( child . Children [ i ] . Children [ 0 ] . Data . FromUtf8Bytes ( ) ) ;
2315- result . Latitude = double . Parse ( child . Children [ i ] . Children [ 1 ] . Data . FromUtf8Bytes ( ) ) ;
2314+ var children = child . Children [ i ] . Children ;
2315+ result . Longitude = children [ 0 ] . ToDouble ( ) ;
2316+ result . Latitude = children [ 1 ] . ToDouble ( ) ;
23162317 }
23172318
23182319 to . Add ( result ) ;
@@ -2322,7 +2323,7 @@ public List<RedisGeoResult> GeoRadius(string key, double longitude, double latit
23222323 return to ;
23232324 }
23242325
2325- public List < RedisGeoResult > GeoRadiusByMember ( string key , string member , double radius , string unit ,
2326+ public List < RedisGeoResult > GeoRadiusByMember ( string key , string member , double radius , string unit ,
23262327 bool withCoords = false , bool withDist = false , bool withHash = false , int ? count = null , bool ? asc = null )
23272328 {
23282329 if ( key == null )
@@ -2374,16 +2375,15 @@ public List<RedisGeoResult> GeoRadiusByMember(string key, string member, double
23742375 var i = 0 ;
23752376 var result = new RedisGeoResult { Unit = unit , Member = child . Children [ i ++ ] . Data . FromUtf8Bytes ( ) } ;
23762377
2377- if ( withDist )
2378- result . Distance = double . Parse ( child . Children [ i ++ ] . Data . FromUtf8Bytes ( ) ) ;
2378+ if ( withDist ) result . Distance = child . Children [ i ++ ] . ToDouble ( ) ;
23792379
2380- if ( withHash )
2381- result . Hash = long . Parse ( child . Children [ i ++ ] . Data . FromUtf8Bytes ( ) ) ;
2380+ if ( withHash ) result . Hash = child . Children [ i ++ ] . ToInt64 ( ) ;
23822381
23832382 if ( withCoords )
23842383 {
2385- result . Longitude = double . Parse ( child . Children [ i ] . Children [ 0 ] . Data . FromUtf8Bytes ( ) ) ;
2386- result . Latitude = double . Parse ( child . Children [ i ] . Children [ 1 ] . Data . FromUtf8Bytes ( ) ) ;
2384+ var children = child . Children [ i ] . Children ;
2385+ result . Longitude = children [ 0 ] . ToDouble ( ) ;
2386+ result . Latitude = children [ 1 ] . ToDouble ( ) ;
23872387 }
23882388
23892389 to . Add ( result ) ;
0 commit comments