diff --git a/src/ZoneTree/PresetTypes/TTLValue.cs b/src/ZoneTree/PresetTypes/TTLValue.cs index 2c86e81..85f0934 100644 --- a/src/ZoneTree/PresetTypes/TTLValue.cs +++ b/src/ZoneTree/PresetTypes/TTLValue.cs @@ -25,8 +25,7 @@ public override bool Equals(object obj) public bool Equals(TTLValue other) { return EqualityComparer.Default.Equals(Value, other.Value) && - Expiration == other.Expiration && - IsExpired == other.IsExpired; + Expiration == other.Expiration; } public void Expire() @@ -36,7 +35,10 @@ public void Expire() public override int GetHashCode() { - return HashCode.Combine(Value, Expiration, IsExpired); + // IsExpired depends on the current time. Including it in the + // hash code would cause different hashes for the same value + // depending on when GetHashCode is called. + return HashCode.Combine(Value, Expiration); } public bool SlideExpiration(TimeSpan timeSpan)