Skip to content

Implement IHybridCache adapter (.NET 9+) #644

Description

@imperugo

Summary

Implement Microsoft.Extensions.Caching.Hybrid.HybridCache backed by StackExchange.Redis.Extensions.

What is HybridCache

HybridCache (.NET 9+) combines L1 (in-memory) and L2 (distributed) caching with stampede protection. It's the recommended caching abstraction going forward, replacing IDistributedCache for most scenarios.

Proposed Integration

services.AddStackExchangeRedisExtensions<SystemTextJsonSerializer>(config);
services.AddRedisHybridCache(); // registers HybridCache with Redis as L2

Considerations

  • Requires .NET 9+ (net9.0/net10.0 TFMs only)
  • Needs `IDistributedCache` as a prerequisite (Implement IDistributedCache adapter #632)
  • Stampede protection is built into HybridCache — we just need the L2 backend
  • Serialization should use our `ISerializer` for consistency

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

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions