StackExchange / StackExchange.Redis

General purpose redis client
https://stackexchange.github.io/StackExchange.Redis/
Other
5.89k stars 1.51k forks source link

GEOPOS of missing key is returning (0,0) instead of marking hasValue flag to false #2460

Closed incloudss closed 1 year ago

incloudss commented 1 year ago

Is this intended behaviour? Because it's quite counter-intuitive. I expected the hasValue getter to return false if there is not position stored for given key, but to my suprise, it returned 0 lat 0 long.

NickCraver commented 1 year ago

Do you have a repro example of this? We have tests around this behavior and I just verified even simplified they do as expected:

    [Fact]
    public void GeoGetPositionMissing()
    {
        using var conn = Create(require: RedisFeatures.v3_2_0);

        var db = conn.GetDatabase();
        RedisKey key = Me();
        db.KeyDelete(key, CommandFlags.FireAndForget);

        var pos = db.GeoPosition(key, "Nowhere");
        Assert.False(pos.HasValue);
    }
NickCraver commented 1 year ago

Need more info to assist further here - closing out to tidy up.