Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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