Skip to content

Items with configured expiration stored in IDistributedCache (using RedisCache) end up non-expiring in Redis #59211

Open
@CaringDev

Description

@CaringDev

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When I store items using e.g.

// ...
services.AddStackExchangeRedisCache(_ => { })
// ...
IDistributedCache cache = // from DI
cache.SetAsync(
    "key",
    "Test"u8.ToArray(),
    new() { AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(10) })

the key ends up as non-expiring in Redis.

Expected Behavior

Keys should be set to expire in Redis if configured accordingly.

Steps To Reproduce

Unfortunately I can only reproduce this in a very specific environment:

  • client with Microsoft.Extensions.Caching.StackExchangeRedis @ 9.0.0 (SE.Redis @ 2.7.27 or 2.8.22) on Suse CloudFoundry
  • Bitnami Redis v7.0.4 (yes, outdated)

Connecting to the same cluster from my development environment (Ubuntu) or downgrading Microsoft.Extensions.Caching.StackExchangeRedis @ 8.0.11 does not trigger the bug (regardless of the SE.Redis version).

Exceptions (if any)

No response

.NET Version

SDK 9.0.100, targeting net9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Attention 👋This issue needs the attention of a contributor, typically because the OP has provided an update.Needs: ReproIndicates that the team needs a repro project to continue the investigation on this issuearea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsfeature-cachingIncludes: StackExchangeRedis and SqlServer distributed caches

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions