3 implementations of IMemoryCache
Microsoft.AspNetCore.Mvc.TagHelpers.Test (1)
CacheTagHelperTest.cs (1)
991private class TestMemoryCache : IMemoryCache
Microsoft.Extensions.Caching.Hybrid.Tests (1)
StampedeTests.cs (1)
32public sealed class InvalidCache : IDistributedCache, IMemoryCache
Microsoft.Extensions.Caching.Memory (1)
MemoryCache.cs (1)
22public class MemoryCache : IMemoryCache
132 references to IMemoryCache
CookieSessionSample (1)
MemoryCacheTicketStore.cs (1)
13private readonly IMemoryCache _cache;
HtmlGenerationWebSite (2)
ProductsService.cs (2)
11private readonly IMemoryCache _memoryCache; 27IMemoryCache memoryCache,
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.Razor.RuntimeCompilation (1)
RuntimeViewCompiler.cs (1)
31private readonly IMemoryCache _cache;
Microsoft.AspNetCore.Mvc.Razor.Test (2)
RazorHotReloadTest.cs (1)
40var lookup = viewEngine.ViewLookupCache;
RazorViewEngineTest.cs (1)
2161public IMemoryCache ViewLookupCachePublic => ViewLookupCache;
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.Mvc.TagHelpers.Test (50)
CacheTagHelperTest.cs (2)
32var cache = new Mock<IMemoryCache>(); 212var mockCache = new Mock<IMemoryCache>();
CacheTagKeyTest.cs (23)
29var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder()) 49var cacheTagHelper1 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder()) 55var cacheTagHelper2 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder()) 73var cacheTagHelper1 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder()) 79var cacheTagHelper2 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder()) 97var cacheTagHelper1 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder()) 103var cacheTagHelper2 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder()) 124var cacheTagHelper1 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder()) 130var cacheTagHelper2 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder()) 177var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder()) 206var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder()) 232var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder()) 260var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder()) 286var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder()) 309new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder()) 333var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder()) 353var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder()) 376var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder()) 397var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder()) 424var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder()) 446var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder()) 478var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder()) 510var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(Mock.Of<IMemoryCache>()), new HtmlTestEncoder())
DefaultFileVersionProviderTest.cs (2)
266var cache = new Mock<IMemoryCache>(); 288IMemoryCache memoryCache = null)
DefaultTagHelperActivatorTest.cs (1)
22private readonly IMemoryCache MemoryCache = new MemoryCache(new MemoryCacheOptions());
GlobbingUrlBuilderTest.cs (6)
251var cache = MakeCache(result: expected); 277var cache = MakeCache(); 415var cache = Mock.Of<IMemoryCache>(m => m.CreateEntry(It.IsAny<object>()) == cacheEntry); 519private static IMemoryCache MakeCache(object result = null) 521var cache = new Mock<IMemoryCache>();
LinkTagHelperTest.cs (10)
303Mock.Of<IMemoryCache>(), 391Mock.Of<IMemoryCache>(), 584Mock.Of<IMemoryCache>(), 625Mock.Of<IMemoryCache>(), 679Mock.Of<IMemoryCache>(), 865Mock.Of<IMemoryCache>(), 919Mock.Of<IMemoryCache>(), 989Mock.Of<IMemoryCache>(), 1032Mock.Of<IMemoryCache>(), 1074Mock.Of<IMemoryCache>(),
ScriptTagHelperTest.cs (6)
280Mock.Of<IMemoryCache>(), 367Mock.Of<IMemoryCache>(), 544Mock.Of<IMemoryCache>(), 597Mock.Of<IMemoryCache>(), 968Mock.Of<IMemoryCache>(), 1006Mock.Of<IMemoryCache>(),
Microsoft.AspNetCore.ResponseCaching (2)
MemoryResponseCache.cs (2)
10private readonly IMemoryCache _cache; 12internal MemoryResponseCache(IMemoryCache cache)
Microsoft.AspNetCore.Session.Tests (1)
SessionTests.cs (1)
1156public UnreliableCache(IMemoryCache memoryCache)
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) 43/// <param name="cache">The <see cref="IMemoryCache"/> instance this method extends.</param> 47public static bool TryGetValue<TItem>(this IMemoryCache cache, object key, out TItem? value) 69/// Associate a value with a key in the <see cref="IMemoryCache"/>. 72/// <param name="cache">The <see cref="IMemoryCache"/> instance this method extends.</param> 76public static TItem Set<TItem>(this IMemoryCache cache, object key, TItem value) 88/// <param name="cache">The <see cref="IMemoryCache"/> instance this method extends.</param> 93public static TItem Set<TItem>(this IMemoryCache cache, object key, TItem value, DateTimeOffset absoluteExpiration) 106/// <param name="cache">The <see cref="IMemoryCache"/> instance this method extends.</param> 111public static TItem Set<TItem>(this IMemoryCache cache, object key, TItem value, TimeSpan absoluteExpirationRelativeToNow) 124/// <param name="cache">The <see cref="IMemoryCache"/> instance this method extends.</param> 129public static TItem Set<TItem>(this IMemoryCache cache, object key, TItem value, IChangeToken expirationToken) 142/// <param name="cache">The <see cref="IMemoryCache"/> instance this method extends.</param> 147public static TItem Set<TItem>(this IMemoryCache cache, object key, TItem value, MemoryCacheEntryOptions? options) 164/// <param name="cache">The <see cref="IMemoryCache"/> instance this method extends.</param> 168public static TItem? GetOrCreate<TItem>(this IMemoryCache cache, object key, Func<ICacheEntry, TItem> factory) 177/// <param name="cache">The <see cref="IMemoryCache"/> instance this method extends.</param> 182public static TItem? GetOrCreate<TItem>(this IMemoryCache cache, object key, Func<ICacheEntry, TItem> factory, MemoryCacheEntryOptions? createOptions) 204/// <param name="cache">The <see cref="IMemoryCache"/> instance this method extends.</param> 208public static Task<TItem?> GetOrCreateAsync<TItem>(this IMemoryCache cache, object key, Func<ICacheEntry, Task<TItem>> factory) 217/// <param name="cache">The <see cref="IMemoryCache"/> instance this method extends.</param> 222public 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)
31private readonly IMemoryCache _localCache; 66_localCache = services.GetRequiredService<IMemoryCache>(); 113internal IMemoryCache LocalCache => _localCache;
Microsoft.Extensions.Caching.Hybrid.Tests (6)
ServiceConstructionTests.cs (1)
199services.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)
144l1 = Assert.IsType<MemoryCache>(lifetime.GetRequiredService<IMemoryCache>());
Microsoft.Extensions.Caching.Memory (13)
MemoryCache.cs (1)
19/// 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. 54/// Asynchronously gets the specified item associated with a key from the <see cref="IMemoryCache"/> as a byte array. 67/// 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"/>.