Skip to content

Commit 914d7e8

Browse files
authored
Upgrade StackExchange.Redis version to 2.7.33 (#527)
* Upgrade StackExchange.Redis version to 2.7.33 by #526 * fix: SE 2.7.33 after returns Position is zero if it does not exist
1 parent 1ebd8e8 commit 914d7e8

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

src/EasyCaching.Redis/DefaultRedisCachingProvider.Geo.cs

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public long GeoAdd(string cacheKey, List<(double longitude, double latitude, str
2121

2222
foreach (var item in values)
2323
{
24-
list.Add( new GeoEntry(item.longitude, item.latitude, item.member));
24+
list.Add(new GeoEntry(item.longitude, item.latitude, item.member));
2525
}
2626

2727
var res = _cache.GeoAdd(cacheKey, list.ToArray());
@@ -115,12 +115,17 @@ public async Task<List<string>> GeoHashAsync(string cacheKey, List<string> membe
115115
{
116116
if (item.HasValue)
117117
{
118-
tuple.Add((Convert.ToDecimal(item.Value.Longitude.ToString()), Convert.ToDecimal(item.Value.Latitude.ToString())));
119-
}
120-
else
121-
{
122-
tuple.Add(null);
118+
var longitude = Convert.ToDecimal(item.Value.Longitude.ToString());
119+
var latitude = Convert.ToDecimal(item.Value.Latitude.ToString());
120+
// returns { Longitude = 0,Latitude = 0 } if it does not exist
121+
if (longitude != 0 && latitude != 0)
122+
{
123+
tuple.Add((longitude, latitude));
124+
continue;
125+
}
123126
}
127+
128+
tuple.Add(null);
124129
}
125130

126131
return tuple;
@@ -145,13 +150,17 @@ public async Task<List<string>> GeoHashAsync(string cacheKey, List<string> membe
145150
{
146151
if (item.HasValue)
147152
{
148-
tuple.Add((Convert.ToDecimal(item.Value.Longitude.ToString()), Convert.ToDecimal(item.Value.Latitude.ToString())));
149-
}
150-
else
151-
{
152-
tuple.Add(null);
153+
var longitude = Convert.ToDecimal(item.Value.Longitude.ToString());
154+
var latitude = Convert.ToDecimal(item.Value.Latitude.ToString());
155+
// returns { Longitude = 0,Latitude = 0 } if it does not exist
156+
if (longitude != 0 && latitude != 0)
157+
{
158+
tuple.Add((longitude, latitude));
159+
continue;
160+
}
153161
}
154162

163+
tuple.Add(null);
155164
}
156165

157166
return tuple;

src/EasyCaching.Redis/EasyCaching.Redis.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
</ItemGroup>
3434

3535
<ItemGroup>
36-
<PackageReference Include="StackExchange.Redis" Version="2.5.43" />
36+
<PackageReference Include="StackExchange.Redis" Version="2.7.33" />
3737
</ItemGroup>
3838
<ItemGroup>
3939
<ProjectReference Include="..\EasyCaching.Core\EasyCaching.Core.csproj" />

0 commit comments

Comments
 (0)