Skip to content

Commit

Permalink
Upgrade StackExchange.Redis version to 2.7.33 (#527)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Memoyu authored Apr 14, 2024
1 parent 1ebd8e8 commit 914d7e8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
31 changes: 20 additions & 11 deletions src/EasyCaching.Redis/DefaultRedisCachingProvider.Geo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public long GeoAdd(string cacheKey, List<(double longitude, double latitude, str

foreach (var item in values)
{
list.Add( new GeoEntry(item.longitude, item.latitude, item.member));
list.Add(new GeoEntry(item.longitude, item.latitude, item.member));
}

var res = _cache.GeoAdd(cacheKey, list.ToArray());
Expand Down Expand Up @@ -115,12 +115,17 @@ public async Task<List<string>> GeoHashAsync(string cacheKey, List<string> membe
{
if (item.HasValue)
{
tuple.Add((Convert.ToDecimal(item.Value.Longitude.ToString()), Convert.ToDecimal(item.Value.Latitude.ToString())));
}
else
{
tuple.Add(null);
var longitude = Convert.ToDecimal(item.Value.Longitude.ToString());
var latitude = Convert.ToDecimal(item.Value.Latitude.ToString());
// returns { Longitude = 0,Latitude = 0 } if it does not exist
if (longitude != 0 && latitude != 0)
{
tuple.Add((longitude, latitude));
continue;
}
}

tuple.Add(null);
}

return tuple;
Expand All @@ -145,13 +150,17 @@ public async Task<List<string>> GeoHashAsync(string cacheKey, List<string> membe
{
if (item.HasValue)
{
tuple.Add((Convert.ToDecimal(item.Value.Longitude.ToString()), Convert.ToDecimal(item.Value.Latitude.ToString())));
}
else
{
tuple.Add(null);
var longitude = Convert.ToDecimal(item.Value.Longitude.ToString());
var latitude = Convert.ToDecimal(item.Value.Latitude.ToString());
// returns { Longitude = 0,Latitude = 0 } if it does not exist
if (longitude != 0 && latitude != 0)
{
tuple.Add((longitude, latitude));
continue;
}
}

tuple.Add(null);
}

return tuple;
Expand Down
2 changes: 1 addition & 1 deletion src/EasyCaching.Redis/EasyCaching.Redis.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="StackExchange.Redis" Version="2.5.43" />
<PackageReference Include="StackExchange.Redis" Version="2.7.33" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EasyCaching.Core\EasyCaching.Core.csproj" />
Expand Down

0 comments on commit 914d7e8

Please sign in to comment.