Microsoft.Extensions.Caching.Hybrid 10.10.0

Microsoft.Extensions.Caching.Hybrid

This package contains a concrete implementation of the HybridCache API, simplifying and enhancing cache usage that might previously have been built on top of IDistributedCache.

Key features:

  • built on top of IDistributedCache - all existing cache backends (Redis, SQL Server, CosmosDB, etc) should work immediately
  • simple API (all the cache, serialization, etc details from are encapsulated)
  • cache-stampede protection (combining of concurrent requests for the same data)
  • performance enhancements such as inbuilt support for the newer IBufferDistributedCache API
  • fully configurable serialization

Full HybridCache documentation is here.

Full documentation

See learn.microsoft.com for full discussion of HybridCache.

Install the package

From the command-line:

dotnet add package Microsoft.Extensions.Caching.Hybrid

Or directly in the C# project file:

<ItemGroup>
  <PackageReference Include="Microsoft.Extensions.Caching.Hybrid" Version="[CURRENTVERSION]" />
</ItemGroup>

Usage example

The HybridCache service can be registered and configured via IServiceCollection, for example:

builder.Services.AddHybridCache(/* optional configuration /*);

Note that in many cases you may also wish to register a distributed cache backend, as discussed here; for example a Redis instance:

builder.Services.AddStackExchangeRedisCache(options =>
{
    options.Configuration = builder.Configuration.GetConnectionString("MyRedisConStr");
});

Once registered, the HybridCache instance can be obtained via dependency-injection, allowing the GetOrCreateAsync API to be used to obtain data:

public class SomeService(HybridCache cache)
{
    private HybridCache _cache = cache;

    public async Task<SomeDataType> GetSomeInfoAsync(string name, int id, CancellationToken token = default)
    {
        return await _cache.GetOrCreateAsync(
            $"{name}-{id}", // Unique key to the cache entry
            async cancel => await GetDataFromTheSourceAsync(name, id, cancel),
            cancellationToken: token
        );
    }

    private async Task<SomeDataType> GetDataFromTheSourceAsync(string name, int id, CancellationToken token)
    {
        // talk to the underlying data store here - could be SQL, gRPC, HTTP, etc
    }
}

Additional usage guidance - including expiration, custom serialization support, and alternate usage to reduce delegate allocation - is available on learn.microsoft.com.

Showing the top 20 packages that depend on Microsoft.Extensions.Caching.Hybrid.

Packages Downloads
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
5
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
9
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
11
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
12
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
15
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
20
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
22
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
25
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
26
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
28
Duende.Spaces
Package Description
5
Microsoft.Extensions.Caching.SqlServer
Distributed cache implementation of Microsoft.Extensions.Caching.Distributed.IDistributedCache using Microsoft SQL Server. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/8af96e042134fb3b2f21df26dd0f32ea1c00dd37
134
Microsoft.Extensions.Caching.SqlServer
Distributed cache implementation of Microsoft.Extensions.Caching.Distributed.IDistributedCache using Microsoft SQL Server. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/ada5ad97d2114250a05550cb28cc18b9cf9f8993
125
Microsoft.Extensions.Caching.SqlServer
Distributed cache implementation of Microsoft.Extensions.Caching.Distributed.IDistributedCache using Microsoft SQL Server. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/f5084525411d53b81d9950b68616117750b674d4
140
Microsoft.Extensions.Caching.StackExchangeRedis
Distributed cache implementation of Microsoft.Extensions.Caching.Distributed.IDistributedCache using Redis. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/8af96e042134fb3b2f21df26dd0f32ea1c00dd37
1
Microsoft.Extensions.Caching.StackExchangeRedis
Distributed cache implementation of Microsoft.Extensions.Caching.Distributed.IDistributedCache using Redis. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/ada5ad97d2114250a05550cb28cc18b9cf9f8993
2

.NET Framework 4.6.2

.NET Standard 2.1

.NET Standard 2.0

.NET 10.0

.NET 9.0

.NET 8.0

Version Downloads Last updated
10.10.0 1 09/10/2026
10.9.0 12 08/13/2026
10.8.0 19 07/15/2026
10.7.0 28 06/10/2026
10.6.0 20 05/13/2026
10.5.0 38 04/16/2026
10.4.0 36 03/12/2026
10.3.0 50 02/13/2026
10.2.0 59 01/14/2026
10.1.0 47 12/11/2025
10.0.0 52 11/16/2025
9.10.0 83 10/15/2025
9.9.0 92 09/10/2025
9.8.0 94 08/14/2025
9.7.0 94 07/09/2025
9.6.0 108 06/13/2025
9.5.0 103 05/15/2025
9.4.0 107 04/09/2025
9.3.0 117 03/30/2025
9.2.0-preview.1.25105.6 107 04/01/2025
9.1.0-preview.1.25064.3 107 04/01/2025
9.0.0-preview.9.24556.5 120 11/22/2024
9.0.0-preview.9.24507.7 112 10/23/2024
9.0.0-preview.7.24406.2 117 08/21/2024
9.0.0-preview.6.24328.4 149 07/20/2024
9.0.0-preview.5.24306.11 153 07/20/2024
9.0.0-preview.4.24267.6 144 07/20/2024