Skip to content

should RedisValue.HasValue check for valueBlob != IntegerSentinel? #229

@jamesmanning

Description

@jamesmanning

Currently a RedisValue created from an int or long will have valueBlob == IntegerSentinel, and since IntegerSentinel is an empty array, HasValue will be false.

/// <summary>
/// Indicates whether the value is either null or a zero-length value
/// </summary>
public bool IsNullOrEmpty
{
get
{
return valueBlob == null || (valueBlob.Length == 0 && !(valueBlob == IntegerSentinel));
}
}
/// <summary>
/// Indicates whether the value is greater than zero-length
/// </summary>
public bool HasValue
{
get
{
return valueBlob != null && valueBlob.Length > 0;
}
}

This might be ByDesign, but it seemed strange since it appears RedisValue instances holding an int or long still have a 'value', just stored in the valueInt64 field instead of the valueBlob one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions