1 interface inheriting from IDistributedCache
Microsoft.Extensions.Caching.Abstractions (1)
10 implementations of IDistributedCache
Microsoft.Extensions.AI.Evaluation.Reporting (1)
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (1)
Microsoft.Extensions.AI.Tests (1)
Microsoft.Extensions.Caching.Hybrid.Tests (5)
Microsoft.Extensions.Caching.Memory (1)
Microsoft.Extensions.Caching.SqlServer (1)
179 references to IDistributedCache
Aspire.StackExchange.Redis.DistributedCaching (5)
Aspire.StackExchange.Redis.DistributedCaching.Tests (14)
Aspire.StackExchange.Redis.Tests (6)
Microsoft.Analyzers.Local.Tests (1)
Microsoft.AspNetCore.Mvc.TagHelpers (4)
Microsoft.AspNetCore.Session (8)
Microsoft.Extensions.AI (18)
Microsoft.Extensions.AI.Evaluation.Reporting (10)
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (3)
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (9)
Microsoft.Extensions.AI.Tests (5)
Microsoft.Extensions.Caching.Abstractions (15)
DistributedCacheExtensions.cs (9)
12/// Extension methods for setting data in an <see cref="IDistributedCache" />.
25public static void Set(this IDistributedCache cache, string key, byte[] value)
42public static Task SetAsync(this IDistributedCache cache, string key, byte[] value, CancellationToken token = default(CancellationToken))
57public static void SetString(this IDistributedCache cache, string key, string value)
70public static void SetString(this IDistributedCache cache, string key, string value, DistributedCacheEntryOptions options)
87public static Task SetStringAsync(this IDistributedCache cache, string key, string value, CancellationToken token = default(CancellationToken))
102public static Task SetStringAsync(this IDistributedCache cache, string key, string value, DistributedCacheEntryOptions options, CancellationToken token = default(CancellationToken))
116public static string? GetString(this IDistributedCache cache, string key)
133public static async Task<string?> GetStringAsync(this IDistributedCache cache, string key, CancellationToken token = default(CancellationToken))
IBufferDistributedCache.cs (4)
21/// <remarks>This method is functionally similar to <see cref="IDistributedCache.Get(string)"/>, but avoids the array allocation.</remarks>
31/// <remarks>This method is functionally similar to <see cref="IDistributedCache.GetAsync(string, CancellationToken)"/>, but avoids the array allocation.</remarks>
40/// <remarks>This method is functionally similar to <see cref="IDistributedCache.Set(string, byte[], DistributedCacheEntryOptions)"/>, but avoids the array allocation.</remarks>
50/// <remarks>This method is functionally similar to <see cref="IDistributedCache.SetAsync(string, byte[], DistributedCacheEntryOptions, CancellationToken)"/>, but avoids the array allocation.</remarks>
Microsoft.Extensions.Caching.Hybrid (4)
Microsoft.Extensions.Caching.Hybrid.Tests (71)
L2Tests.cs (14)
40services.AddSingleton<IDistributedCache>(buffers ? new BufferLoggingCache(Log, localCache) : new LoggingCache(Log, localCache));
199static ServiceProvider CreateNode(IDistributedCache backend, TimeProvider clock)
211public BufferLoggingCache(ITestOutputHelper log, IDistributedCache tail)
259internal class LoggingCache(ITestOutputHelper log, IDistributedCache tail) : IDistributedCache
262protected IDistributedCache Tail => tail;
268byte[]? IDistributedCache.Get(string key)
275Task<byte[]?> IDistributedCache.GetAsync(string key, CancellationToken token)
282void IDistributedCache.Refresh(string key)
289Task IDistributedCache.RefreshAsync(string key, CancellationToken token)
296void IDistributedCache.Remove(string key)
303Task IDistributedCache.RemoveAsync(string key, CancellationToken token)
310void IDistributedCache.Set(string key, byte[] value, DistributedCacheEntryOptions options)
317Task IDistributedCache.SetAsync(string key, byte[] value, DistributedCacheEntryOptions options, CancellationToken token)
325private sealed class DelayedTagReadCache(IDistributedCache inner, string tag) : IDistributedCache
ServiceConstructionTests.cs (20)
59services.TryAddKeyedSingleton<IDistributedCache, CustomMemoryDistributedCache1>(typeof(CustomMemoryDistributedCache1));
68Assert.Same(backend, provider.GetRequiredKeyedService<IDistributedCache>(typeof(CustomMemoryDistributedCache1)));
184services.TryAddKeyedSingleton<IDistributedCache, CustomMemoryDistributedCache1>(typeof(CustomMemoryDistributedCache1));
185services.TryAddKeyedSingleton<IDistributedCache, CustomMemoryDistributedCache2>(typeof(CustomMemoryDistributedCache2));
195Assert.Same(cacheOneBackend, provider.GetRequiredKeyedService<IDistributedCache>(typeof(CustomMemoryDistributedCache1)));
201Assert.Same(cacheTwoBackend, provider.GetRequiredKeyedService<IDistributedCache>(typeof(CustomMemoryDistributedCache2)));
209services.AddSingleton<IDistributedCache, CustomMemoryDistributedCache1>();
244services.AddKeyedSingleton<IDistributedCache, RedisCache>("Redis");
246services.AddKeyedSingleton<IDistributedCache, SqlServerCache>("SqlServer",
260Assert.Same(hybridWithRedisBackend, provider.GetRequiredKeyedService<IDistributedCache>("Redis"));
264Assert.Same(hybridWithSqlServerBackend, provider.GetRequiredKeyedService<IDistributedCache>("SqlServer"));
321services.AddKeyedSingleton<IDistributedCache, CustomMemoryDistributedCache1>("DistributedOne");
322services.AddKeyedSingleton<IDistributedCache, CustomMemoryDistributedCache2>("DistributedTwo");
361services.AddKeyedSingleton<IDistributedCache, CustomMemoryDistributedCache1>("DistributedOne");
362services.AddKeyedSingleton<IDistributedCache, CustomMemoryDistributedCache2>("DistributedTwo");
399services.AddKeyedSingleton<IDistributedCache, CustomMemoryDistributedCache1>("DistributedOne");
400services.AddKeyedSingleton<IDistributedCache, CustomMemoryDistributedCache2>("DistributedTwo");
497services.AddSingleton<IDistributedCache, MemoryDistributedCache>();
515services.AddSingleton<IDistributedCache, CustomMemoryDistributedCache1>();
531services.AddSingleton<IDistributedCache, MemoryDistributedCache>();
Microsoft.Extensions.Caching.Memory (4)
Microsoft.Extensions.Caching.SqlServer (1)
Microsoft.Extensions.Caching.StackExchangeRedis (1)