2 implementations of IMemoryCache
Microsoft.Extensions.Caching.Hybrid.Tests (1)
StampedeTests.cs (1)
32public sealed class InvalidCache : IDistributedCache, IMemoryCache
Microsoft.Extensions.Caching.Memory (1)
MemoryCache.cs (1)
25public class MemoryCache : IMemoryCache
125 references to IMemoryCache
aspire (4)
Mcp\Docs\DocsCache.cs (2)
21private readonly IMemoryCache _memoryCache; 25public DocsCache(IMemoryCache memoryCache, CliExecutionContext executionContext, ILogger<DocsCache> logger)
NuGet\NuGetPackageCache.cs (1)
22internal sealed class NuGetPackageCache(IDotNetCliRunner cliRunner, IMemoryCache memoryCache, AspireCliTelemetry telemetry, IFeatures features) : INuGetPackageCache
Projects\ProjectUpdater.cs (1)
26internal sealed partial class ProjectUpdater(ILogger<ProjectUpdater> logger, IDotNetCliRunner runner, IInteractionService interactionService, IMemoryCache cache, CliExecutionContext executionContext, FallbackProjectParser fallbackParser) : IProjectUpdater
Aspire.Cli.Tests (42)
Projects\ProjectUpdaterTests.cs (38)
118var cache = provider.GetRequiredService<IMemoryCache>(); 230var cache = provider.GetRequiredService<IMemoryCache>(); 369var cache = provider.GetRequiredService<IMemoryCache>(); 521var cache = provider.GetRequiredService<IMemoryCache>(); 664var cache = provider.GetRequiredService<IMemoryCache>(); 769var cache = provider.GetRequiredService<IMemoryCache>(); 872var cache = provider.GetRequiredService<IMemoryCache>(); 1015var cache = provider.GetRequiredService<IMemoryCache>(); 1138var cache = provider.GetRequiredService<IMemoryCache>(); 1252var cache = provider.GetRequiredService<IMemoryCache>(); 1362var cache = provider.GetRequiredService<IMemoryCache>(); 1460var cache = provider.GetRequiredService<IMemoryCache>(); 1562var cache = provider.GetRequiredService<IMemoryCache>(); 1641var cache = provider.GetRequiredService<IMemoryCache>(); 1723var cache = provider.GetRequiredService<IMemoryCache>(); 1802var cache = provider.GetRequiredService<IMemoryCache>(); 1885var cache = provider.GetRequiredService<IMemoryCache>(); 1973var cache = provider.GetRequiredService<IMemoryCache>(); 2352var cache = provider.GetRequiredService<IMemoryCache>();
Utils\CliTestHelper.cs (4)
372var cache = serviceProvider.GetRequiredService<IMemoryCache>(); 434var cache = serviceProvider.GetRequiredService<IMemoryCache>();
Microsoft.AspNetCore.HeaderParsing (1)
HeaderKey.cs (1)
29private readonly IMemoryCache? _valueCache;
Microsoft.AspNetCore.Mvc.Razor (4)
DependencyInjection\MvcRazorMvcCoreBuilderExtensions.cs (1)
151services.TryAddSingleton<IMemoryCache, MemoryCache>();
Infrastructure\DefaultFileVersionProvider.cs (1)
34public IMemoryCache Cache { get; }
Infrastructure\TagHelperMemoryCacheProvider.cs (1)
18public IMemoryCache Cache { get; internal set; } = new MemoryCache(new MemoryCacheOptions
RazorViewEngine.cs (1)
89protected internal IMemoryCache ViewLookupCache { get; private set; }
Microsoft.AspNetCore.Mvc.TagHelpers (18)
CacheTagHelper.cs (3)
38/// <param name="factory">The factory containing the private <see cref="IMemoryCache"/> instance 50/// Gets the <see cref="IMemoryCache"/> instance used to cache entries. 52protected IMemoryCache MemoryCache { get; }
CacheTagHelperMemoryCacheFactory.cs (4)
10/// A factory for <see cref="IMemoryCache"/>s configured using <see cref="CacheTagHelperOptions"/>. 29internal CacheTagHelperMemoryCacheFactory(IMemoryCache cache) 35/// Gets the <see cref="IMemoryCache"/>. 37public IMemoryCache Cache { get; }
DistributedCacheTagHelper.cs (2)
42/// Gets the <see cref="IMemoryCache"/> instance used to cache workers. 44protected IMemoryCache MemoryCache { get; }
GlobbingUrlBuilder.cs (3)
33public GlobbingUrlBuilder(IFileProvider fileProvider, IMemoryCache cache, PathString requestPathBase) 45/// The <see cref="IMemoryCache"/> to cache globbing results in. 47public IMemoryCache Cache { get; }
ImageTagHelper.cs (2)
101/// Gets the <see cref="IMemoryCache"/> used to store globbed urls. 105protected internal IMemoryCache Cache { get; }
LinkTagHelper.cs (2)
216/// Gets the <see cref="IMemoryCache"/> used to store globbed urls. 218protected internal IMemoryCache Cache { get; }
ScriptTagHelper.cs (2)
206/// Gets the <see cref="IMemoryCache"/> used to store globbed urls. 208protected internal IMemoryCache Cache { get; private set; }
Microsoft.AspNetCore.ResponseCaching (2)
MemoryResponseCache.cs (2)
10private readonly IMemoryCache _cache; 12internal MemoryResponseCache(IMemoryCache cache)
Microsoft.Extensions.Caching.Abstractions (28)
ICacheEntry.cs (1)
11/// Represents an entry in the <see cref="IMemoryCache"/> implementation.
MemoryCacheEntryOptions.cs (1)
11/// Represents the cache options applied to an entry of the <see cref="IMemoryCache"/> instance.
MemoryCacheExtensions.cs (26)
11/// Provides extensions methods for <see cref="IMemoryCache"/> operations. 18/// <param name="cache">The <see cref="IMemoryCache"/> instance this method extends.</param> 21public static object? Get(this IMemoryCache cache, object key) 31/// <param name="cache">The <see cref="IMemoryCache"/> instance this method extends.</param> 34public static TItem? Get<TItem>(this IMemoryCache cache, object key) 44/// <param name="cache">The <see cref="IMemoryCache"/> instance this method extends.</param> 48public static bool TryGetValue<TItem>(this IMemoryCache cache, object key, out TItem? value) 70/// Associate a value with a key in the <see cref="IMemoryCache"/>. 73/// <param name="cache">The <see cref="IMemoryCache"/> instance this method extends.</param> 77public static TItem Set<TItem>(this IMemoryCache cache, object key, TItem value) 90/// <param name="cache">The <see cref="IMemoryCache"/> instance this method extends.</param> 95public static TItem Set<TItem>(this IMemoryCache cache, object key, TItem value, DateTimeOffset absoluteExpiration) 108/// <param name="cache">The <see cref="IMemoryCache"/> instance this method extends.</param> 113public static TItem Set<TItem>(this IMemoryCache cache, object key, TItem value, TimeSpan absoluteExpirationRelativeToNow) 126/// <param name="cache">The <see cref="IMemoryCache"/> instance this method extends.</param> 131public static TItem Set<TItem>(this IMemoryCache cache, object key, TItem value, IChangeToken expirationToken) 144/// <param name="cache">The <see cref="IMemoryCache"/> instance this method extends.</param> 149public static TItem Set<TItem>(this IMemoryCache cache, object key, TItem value, MemoryCacheEntryOptions? options) 166/// <param name="cache">The <see cref="IMemoryCache"/> instance this method extends.</param> 170public static TItem? GetOrCreate<TItem>(this IMemoryCache cache, object key, Func<ICacheEntry, TItem> factory) 179/// <param name="cache">The <see cref="IMemoryCache"/> instance this method extends.</param> 184public static TItem? GetOrCreate<TItem>(this IMemoryCache cache, object key, Func<ICacheEntry, TItem> factory, MemoryCacheEntryOptions? createOptions) 206/// <param name="cache">The <see cref="IMemoryCache"/> instance this method extends.</param> 210public static Task<TItem?> GetOrCreateAsync<TItem>(this IMemoryCache cache, object key, Func<ICacheEntry, Task<TItem>> factory) 219/// <param name="cache">The <see cref="IMemoryCache"/> instance this method extends.</param> 224public static async Task<TItem?> GetOrCreateAsync<TItem>(this IMemoryCache cache, object key, Func<ICacheEntry, Task<TItem>> factory, MemoryCacheEntryOptions? createOptions)
Microsoft.Extensions.Caching.Hybrid (3)
Internal\DefaultHybridCache.cs (3)
32private readonly IMemoryCache _localCache; 75_localCache = services.GetRequiredService<IMemoryCache>(); 134internal IMemoryCache LocalCache => _localCache;
Microsoft.Extensions.Caching.Hybrid.Tests (10)
ExpirationTests.cs (1)
33services.AddSingleton<IMemoryCache>(l1);
LocalInvalidationTests.cs (1)
54using IMemoryCache l1 = new MemoryCache(new MemoryCacheOptions());
ServiceConstructionTests.cs (3)
223var localCache = provider.GetRequiredService<IMemoryCache>(); 538services.AddSingleton<IMemoryCache, CustomMemoryCache>();
StampedeTests.cs (4)
19services.AddSingleton<IMemoryCache, InvalidCache>(); 39ICacheEntry IMemoryCache.CreateEntry(object key) => throw new NotSupportedException("Intentionally not provided"); 51void IMemoryCache.Remove(object key) => throw new NotSupportedException("Intentionally not provided"); 59bool IMemoryCache.TryGetValue(object key, out object? value) => throw new NotSupportedException("Intentionally not provided");
UnreliableL2Tests.cs (1)
146l1 = Assert.IsType<MemoryCache>(lifetime.GetRequiredService<IMemoryCache>());
Microsoft.Extensions.Caching.Memory (13)
MemoryCache.cs (1)
22/// Implements <see cref="IMemoryCache"/> using a dictionary to
MemoryCacheServiceCollectionExtensions.cs (3)
17/// Adds a non distributed in-memory implementation of <see cref="IMemoryCache"/> to the 27services.TryAdd(ServiceDescriptor.Singleton<IMemoryCache, MemoryCache>()); 33/// Adds a non distributed in-memory implementation of <see cref="IMemoryCache"/> to the
MemoryDistributedCache.cs (9)
15/// Implements <see cref="IDistributedCache"/> using <see cref="IMemoryCache"/>. 42/// Gets the specified item associated with a key from the <see cref="IMemoryCache"/> as a byte array. 55/// Asynchronously gets the specified item associated with a key from the <see cref="IMemoryCache"/> as a byte array. 68/// Sets the specified item associated with a key in the <see cref="IMemoryCache"/> as a byte array. 88/// Asynchronously sets the specified item associated with a key in the <see cref="IMemoryCache"/> as a byte array. 106/// Refreshes the specified item associated with a key from the <see cref="IMemoryCache"/>. 117/// Asynchronously refreshes the specified item associated with a key from the <see cref="IMemoryCache"/>. 131/// Removes the specified item associated with a key from the <see cref="IMemoryCache"/>. 142/// Asynchronously removes the specified item associated with a key from the <see cref="IMemoryCache"/>.