GEOSEARCH & GEOSEARCHSTORE by slorello89 · Pull Request #2089 · StackExchange/StackExchange.Redis (original) (raw)

@NickCraver

This PR implements GEOSEARCH and GEOSEARCHSTORE for #2055

To abstract the box/circle sub-options from GEOSEARCH I added a new abstract class GeoSearchShape who's children are responsible for maintaining the bounding shape, its unit of measurement, the number of arguments required for the sub-option, and of course the sub-option name. Rather than casting/extracting the arguments, I have it use an IEnumerable state-machine with yield/return. Wasn't sure which was the better option, the IEnumerable seemed cleaner, open to whichever you want.

I changed the GEORADIUS pattern of having a GeoSearch(key, member, args. . .) and a GeoSearch(key, lon, lat, args. . .), and instead have GeoSearchByMember and GeoSearchByCoordinates. If I'm honest, it was because my IDE was complaining about breaking compatibility rules by having more than 1 override with optional parameters, not sure if you have a strong feeling on this.

Tried to maintain the single array-allocation pattern you added to #2075