Skip to content

InMemoryCacheClient: SetIfHigher/SetIfLower with a non-winning value still changes the TTL, unlike Redis #581

Open

Description

@niemyjski

When the existing value wins, InMemoryCacheClient still applies expiresIn (current.WithExpiration(expiresAt) in SetIfAsync). With expiresIn: null, it clears an existing TTL. Redis's SetIfHigher.lua/SetIfLower.lua leave the key untouched and return 0.

main behaved this way before #570, which kept it on purpose to avoid an unrelated behavior change. The fix is one line (return current instead of current.WithExpiration(expiresAt)) plus a shared contract test in CacheClientTestsBase. Anyone relying on it today (for example, sliding a TTL with SetIfHigher) would need a heads-up.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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