3 instantiations of OutputCacheContext
Microsoft.AspNetCore.OutputCaching (1)
OutputCacheMiddleware.cs (1)
94var context = new OutputCacheContext { HttpContext = httpContext };
Microsoft.AspNetCore.OutputCaching.Tests (2)
TestUtils.cs (2)
231return new OutputCacheContext() 251return new OutputCacheContext()
248 references to OutputCacheContext
Microsoft.AspNetCore.OutputCaching (94)
IOutputCacheFeature.cs (1)
14OutputCacheContext Context { get; }
IOutputCacheKeyProvider.cs (2)
11/// <param name="context">The <see cref="OutputCacheContext"/>.</param> 13string CreateStorageKey(OutputCacheContext context);
IOutputCachePolicy.cs (6)
12/// Updates the <see cref="OutputCacheContext"/> before the cache middleware is invoked. 17ValueTask CacheRequestAsync(OutputCacheContext context, CancellationToken cancellation); 20/// Updates the <see cref="OutputCacheContext"/> before the cached response is used. 25ValueTask ServeFromCacheAsync(OutputCacheContext context, CancellationToken cancellation); 28/// Updates the <see cref="OutputCacheContext"/> before the response is served and can be cached. 33ValueTask ServeResponseAsync(OutputCacheContext context, CancellationToken cancellation);
OutputCacheContext.cs (1)
14/// Constructs a new instance of <see cref="OutputCacheContext"/>.
OutputCacheFeature.cs (2)
8public OutputCacheFeature(OutputCacheContext context) 13public OutputCacheContext Context { get; }
OutputCacheKeyProvider.cs (6)
38public string CreateStorageKey(OutputCacheContext context) 74public static bool TryAppendKeyPrefix(OutputCacheContext context, StringBuilder builder) 94public bool TryAppendBaseKey(OutputCacheContext context, StringBuilder builder) 136public bool TryAppendVaryByKey(OutputCacheContext context, StringBuilder builder) 142throw new InvalidOperationException($"{nameof(OutputCacheContext.CacheVaryByRules)} must not be null on the {nameof(OutputCacheContext)}");
OutputCacheMiddleware.cs (12)
94var context = new OutputCacheContext { HttpContext = httpContext }; 253internal async Task<bool> TryServeCachedResponseAsync(OutputCacheContext context, OutputCacheEntry? cacheEntry, IReadOnlyList<IOutputCachePolicy> policies) 330internal async Task<bool> TryServeFromCacheAsync(OutputCacheContext cacheContext, IReadOnlyList<IOutputCachePolicy> policies) 375internal void CreateCacheKey(OutputCacheContext context) 389internal void FinalizeCacheHeaders(OutputCacheContext context) 416internal async ValueTask FinalizeCacheBodyAsync(OutputCacheContext context) 462private bool OnStartResponse(OutputCacheContext context) 474internal void StartResponse(OutputCacheContext context) 482internal static void AddOutputCacheFeature(OutputCacheContext context) 492internal void ShimResponseStream(OutputCacheContext context) 507internal static void UnshimResponseStream(OutputCacheContext context) 516internal bool ContentIsNotModified(OutputCacheContext context)
OutputCachePolicyBuilder.cs (3)
20private List<Func<OutputCacheContext, CancellationToken, ValueTask<bool>>>? _requirements; 64public OutputCachePolicyBuilder With(Func<OutputCacheContext, CancellationToken, ValueTask<bool>> predicate) 78public OutputCachePolicyBuilder With(Func<OutputCacheContext, bool> predicate)
Policies\CompositePolicy.cs (3)
23async ValueTask IOutputCachePolicy.CacheRequestAsync(OutputCacheContext context, CancellationToken cancellationToken) 32async ValueTask IOutputCachePolicy.ServeFromCacheAsync(OutputCacheContext context, CancellationToken cancellationToken) 41async ValueTask IOutputCachePolicy.ServeResponseAsync(OutputCacheContext context, CancellationToken cancellationToken)
Policies\DefaultPolicy.cs (4)
21ValueTask IOutputCachePolicy.CacheRequestAsync(OutputCacheContext context, CancellationToken cancellationToken) 36ValueTask IOutputCachePolicy.ServeFromCacheAsync(OutputCacheContext context, CancellationToken cancellationToken) 42ValueTask IOutputCachePolicy.ServeResponseAsync(OutputCacheContext context, CancellationToken cancellationToken) 63private static bool AttemptOutputCaching(OutputCacheContext context)
Policies\EmptyPolicy.cs (3)
18ValueTask IOutputCachePolicy.CacheRequestAsync(OutputCacheContext context, CancellationToken cancellationToken) 24ValueTask IOutputCachePolicy.ServeFromCacheAsync(OutputCacheContext context, CancellationToken cancellationToken) 30ValueTask IOutputCachePolicy.ServeResponseAsync(OutputCacheContext context, CancellationToken cancellationToken)
Policies\EnableCachePolicy.cs (3)
19ValueTask IOutputCachePolicy.CacheRequestAsync(OutputCacheContext context, CancellationToken cancellationToken) 27ValueTask IOutputCachePolicy.ServeResponseAsync(OutputCacheContext context, CancellationToken cancellationToken) 33ValueTask IOutputCachePolicy.ServeFromCacheAsync(OutputCacheContext context, CancellationToken cancellationToken)
Policies\ExpirationPolicy.cs (3)
23ValueTask IOutputCachePolicy.CacheRequestAsync(OutputCacheContext context, CancellationToken cancellationToken) 31ValueTask IOutputCachePolicy.ServeFromCacheAsync(OutputCacheContext context, CancellationToken cancellationToken) 37ValueTask IOutputCachePolicy.ServeResponseAsync(OutputCacheContext context, CancellationToken cancellationToken)
Policies\LockingPolicy.cs (3)
29ValueTask IOutputCachePolicy.CacheRequestAsync(OutputCacheContext context, CancellationToken cancellationToken) 37ValueTask IOutputCachePolicy.ServeFromCacheAsync(OutputCacheContext context, CancellationToken cancellationToken) 43ValueTask IOutputCachePolicy.ServeResponseAsync(OutputCacheContext context, CancellationToken cancellationToken)
Policies\NamedPolicy.cs (4)
28ValueTask IOutputCachePolicy.ServeResponseAsync(OutputCacheContext context, CancellationToken cancellationToken) 41ValueTask IOutputCachePolicy.ServeFromCacheAsync(OutputCacheContext context, CancellationToken cancellationToken) 54ValueTask IOutputCachePolicy.CacheRequestAsync(OutputCacheContext context, CancellationToken cancellationToken) 66internal IOutputCachePolicy? GetProfilePolicy(OutputCacheContext context)
Policies\NoLookupPolicy.cs (3)
18ValueTask IOutputCachePolicy.ServeResponseAsync(OutputCacheContext context, CancellationToken cancellationToken) 26ValueTask IOutputCachePolicy.ServeFromCacheAsync(OutputCacheContext context, CancellationToken cancellationToken) 32ValueTask IOutputCachePolicy.CacheRequestAsync(OutputCacheContext context, CancellationToken cancellationToken)
Policies\NoStorePolicy.cs (3)
18ValueTask IOutputCachePolicy.ServeResponseAsync(OutputCacheContext context, CancellationToken cancellationToken) 26ValueTask IOutputCachePolicy.ServeFromCacheAsync(OutputCacheContext context, CancellationToken cancellationToken) 32ValueTask IOutputCachePolicy.CacheRequestAsync(OutputCacheContext context, CancellationToken cancellationToken)
Policies\PredicatePolicy.cs (7)
13private readonly Func<OutputCacheContext, ValueTask<bool>> _predicate; 21public PredicatePolicy(Func<OutputCacheContext, ValueTask<bool>> asyncPredicate, IOutputCachePolicy policy) 28ValueTask IOutputCachePolicy.CacheRequestAsync(OutputCacheContext context, CancellationToken cancellationToken) 34ValueTask IOutputCachePolicy.ServeFromCacheAsync(OutputCacheContext context, CancellationToken cancellationToken) 40ValueTask IOutputCachePolicy.ServeResponseAsync(OutputCacheContext context, CancellationToken cancellationToken) 45private ValueTask ExecuteAwaited(Func<IOutputCachePolicy, OutputCacheContext, CancellationToken, ValueTask> action, IOutputCachePolicy policy, OutputCacheContext context, CancellationToken cancellationToken)
Policies\SetCacheKeyPrefixPolicy.cs (3)
24ValueTask IOutputCachePolicy.CacheRequestAsync(OutputCacheContext context, CancellationToken cancellationToken) 30ValueTask IOutputCachePolicy.ServeFromCacheAsync(OutputCacheContext context, CancellationToken cancellationToken) 36ValueTask IOutputCachePolicy.ServeResponseAsync(OutputCacheContext context, CancellationToken cancellationToken)
Policies\TagsPolicy.cs (3)
23ValueTask IOutputCachePolicy.CacheRequestAsync(OutputCacheContext context, CancellationToken cancellationToken) 34ValueTask IOutputCachePolicy.ServeFromCacheAsync(OutputCacheContext context, CancellationToken cancellationToken) 40ValueTask IOutputCachePolicy.ServeResponseAsync(OutputCacheContext context, CancellationToken cancellationToken)
Policies\TypedPolicy.cs (4)
31private IOutputCachePolicy? CreatePolicy(OutputCacheContext context) 38ValueTask IOutputCachePolicy.CacheRequestAsync(OutputCacheContext context, CancellationToken cancellationToken) 44ValueTask IOutputCachePolicy.ServeFromCacheAsync(OutputCacheContext context, CancellationToken cancellationToken) 50ValueTask IOutputCachePolicy.ServeResponseAsync(OutputCacheContext context, CancellationToken cancellationToken)
Policies\VaryByHeaderPolicy.cs (3)
39ValueTask IOutputCachePolicy.CacheRequestAsync(OutputCacheContext context, CancellationToken cancellationToken) 54ValueTask IOutputCachePolicy.ServeFromCacheAsync(OutputCacheContext context, CancellationToken cancellationToken) 60ValueTask IOutputCachePolicy.ServeResponseAsync(OutputCacheContext context, CancellationToken cancellationToken)
Policies\VaryByHostPolicy.cs (3)
25ValueTask IOutputCachePolicy.CacheRequestAsync(OutputCacheContext context, CancellationToken cancellationToken) 33ValueTask IOutputCachePolicy.ServeFromCacheAsync(OutputCacheContext context, CancellationToken cancellationToken) 39ValueTask IOutputCachePolicy.ServeResponseAsync(OutputCacheContext context, CancellationToken cancellationToken)
Policies\VaryByQueryPolicy.cs (3)
40ValueTask IOutputCachePolicy.CacheRequestAsync(OutputCacheContext context, CancellationToken cancellationToken) 62ValueTask IOutputCachePolicy.ServeFromCacheAsync(OutputCacheContext context, CancellationToken cancellationToken) 68ValueTask IOutputCachePolicy.ServeResponseAsync(OutputCacheContext context, CancellationToken cancellationToken)
Policies\VaryByRouteValuePolicy.cs (3)
39ValueTask IOutputCachePolicy.CacheRequestAsync(OutputCacheContext context, CancellationToken cancellationToken) 46ValueTask IOutputCachePolicy.ServeFromCacheAsync(OutputCacheContext context, CancellationToken cancellationToken) 52ValueTask IOutputCachePolicy.ServeResponseAsync(OutputCacheContext context, CancellationToken cancellationToken)
Policies\VaryByValuePolicy.cs (3)
28ValueTask IOutputCachePolicy.CacheRequestAsync(OutputCacheContext context, CancellationToken cancellationToken) 34ValueTask IOutputCachePolicy.ServeFromCacheAsync(OutputCacheContext context, CancellationToken cancellationToken) 40ValueTask IOutputCachePolicy.ServeResponseAsync(OutputCacheContext context, CancellationToken cancellationToken)
Microsoft.AspNetCore.OutputCaching.Tests (153)
OutputCacheAttributeTests.cs (9)
14var context = TestUtils.CreateUninitializedContext(); 25var context = TestUtils.CreateUninitializedContext(); 37var context = TestUtils.CreateUninitializedContext(); 51var context = TestUtils.CreateUninitializedContext(options: options); 66var context = TestUtils.CreateUninitializedContext(options: options); 77var context = TestUtils.CreateUninitializedContext(); 93var context = TestUtils.CreateUninitializedContext(); 108var context = TestUtils.CreateUninitializedContext(); 127var context = TestUtils.CreateUninitializedContext();
OutputCacheKeyProviderTests.cs (30)
19var context = TestUtils.CreateTestContext(); 34var context = TestUtils.CreateTestContext(); 54var context = TestUtils.CreateTestContext(); 69var context = TestUtils.CreateTestContext(); 79var context = TestUtils.CreateTestContext(); 88var context = TestUtils.CreateTestContext(); 98var context = TestUtils.CreateTestContext(); 111var context = TestUtils.CreateTestContext(); 132var context = TestUtils.CreateTestContext(); 144var context = TestUtils.CreateTestContext(); 157var context = TestUtils.CreateTestContext(); 169var context = TestUtils.CreateTestContext(); 182var context = TestUtils.CreateTestContext(); 195var context = TestUtils.CreateTestContext(); 208var context = TestUtils.CreateTestContext(); 221var context = TestUtils.CreateTestContext(); 236var context = TestUtils.CreateTestContext(); 251var context = TestUtils.CreateTestContext(); 266var context = TestUtils.CreateTestContext(); 285var context = TestUtils.CreateTestContext(); 297var context = TestUtils.CreateTestContext(); 310var context = TestUtils.CreateTestContext(); 322var context = TestUtils.CreateTestContext(); 336var context = TestUtils.CreateTestContext(); 350var context = TestUtils.CreateTestContext(); 363var context = TestUtils.CreateTestContext(); 376var context = TestUtils.CreateTestContext(); 389var context = TestUtils.CreateTestContext(); 403var context = TestUtils.CreateTestContext(); 418var context = TestUtils.CreateTestContext();
OutputCacheMiddlewareTests.cs (44)
38var context = TestUtils.CreateTestContext(cache: cache); 58var context = TestUtils.CreateTestContext(cache: cache); 74var context = TestUtils.CreateTestContext(cache: cache); 102var context = TestUtils.CreateTestContext(cache: cache); 132var context = TestUtils.CreateTestContext(cache: cache); 161var context = TestUtils.CreateTestContext(testSink: sink); 174var context = TestUtils.CreateTestContext(testSink: sink); 213var context = TestUtils.CreateTestContext(testSink: sink); 255var context = TestUtils.CreateTestContext(testSink: sink); 276var context = TestUtils.CreateTestContext(testSink: sink); 294var context = TestUtils.CreateTestContext(testSink: sink); 323var context = TestUtils.CreateTestContext(testSink: sink); 340var context = TestUtils.CreateTestContext(testSink: sink); 355var context = TestUtils.CreateTestContext(testSink: sink); 375var context = TestUtils.CreateTestContext(); 391var context = TestUtils.CreateTestContext(); 410var context = TestUtils.CreateTestContext(); 430var context = TestUtils.CreateTestContext(); 453var context = TestUtils.CreateTestContext(); 479var context = TestUtils.CreateTestContext(); 520var context = TestUtils.CreateTestContext(cache: cache); 539var context = TestUtils.CreateTestContext(); 560var context = TestUtils.CreateTestContext(); 578var context = TestUtils.CreateTestContext(); 593var context = TestUtils.CreateTestContext(); 608var context = TestUtils.CreateTestContext(cache: cache); 636var context = TestUtils.CreateTestContext(cache: cache); 665var context = TestUtils.CreateTestContext(cache: cache); 696var context = TestUtils.CreateTestContext(cache: cache); 721var context = TestUtils.CreateTestContext(cache: cache); 742var context = TestUtils.CreateTestContext(cache: cache); 768var context = TestUtils.CreateTestContext(); 794var context = TestUtils.CreateTestContext(httpContext); 831var context1 = TestUtils.CreateTestContext(); 835var context2 = TestUtils.CreateTestContext(); 882var context1 = TestUtils.CreateTestContext(); 887var context2 = TestUtils.CreateTestContext(); 946var context1 = TestUtils.CreateTestContext(); 950var context2 = TestUtils.CreateTestContext(); 969var context = TestUtils.CreateTestContext(cache: cache); 993public ValueTask CacheRequestAsync(OutputCacheContext context, CancellationToken cancellation) 1000public ValueTask ServeFromCacheAsync(OutputCacheContext context, CancellationToken cancellation) 1005public ValueTask ServeResponseAsync(OutputCacheContext context, CancellationToken cancellation) 1042var requestContext = TestUtils.CreateTestContext(cache: cache);
OutputCachePoliciesTests.cs (23)
14var context = TestUtils.CreateUninitializedContext(); 25var context = TestUtils.CreateUninitializedContext(); 36var context = TestUtils.CreateUninitializedContext(); 47var context = TestUtils.CreateUninitializedContext(); 58var context = TestUtils.CreateUninitializedContext(); 70var context = TestUtils.CreateUninitializedContext(); 82var context = TestUtils.CreateUninitializedContext(); 93var context = TestUtils.CreateUninitializedContext(); 104var context = TestUtils.CreateUninitializedContext(); 115var context = TestUtils.CreateUninitializedContext(); 126var context = TestUtils.CreateUninitializedContext(); 141var context = TestUtils.CreateUninitializedContext(); 154var context = TestUtils.CreateUninitializedContext(options: options); 172var context = TestUtils.CreateUninitializedContext(); 185var context = TestUtils.CreateUninitializedContext(); 197var context = TestUtils.CreateUninitializedContext(); 210var context = TestUtils.CreateUninitializedContext(); 223var context = TestUtils.CreateUninitializedContext(); 235var context = TestUtils.CreateUninitializedContext(); 248var context = TestUtils.CreateUninitializedContext(); 261var context = TestUtils.CreateUninitializedContext(); 274var context = TestUtils.CreateUninitializedContext(); 287var context = TestUtils.CreateUninitializedContext();
OutputCachePolicyBuilderTests.cs (24)
32var context = TestUtils.CreateUninitializedContext(); 46var context = TestUtils.CreateUninitializedContext(); 63var context = TestUtils.CreateUninitializedContext(options: options); 81var context = TestUtils.CreateUninitializedContext(options: options); 94var context = TestUtils.CreateUninitializedContext(); 106var context = TestUtils.CreateUninitializedContext(); 123var context = TestUtils.CreateUninitializedContext(); 139var context = TestUtils.CreateUninitializedContext(); 159var context = TestUtils.CreateUninitializedContext(); 179var context = TestUtils.CreateUninitializedContext(); 199var context1 = TestUtils.CreateUninitializedContext(); 200var context2 = TestUtils.CreateUninitializedContext(); 201var context3 = TestUtils.CreateUninitializedContext(); 219var context = TestUtils.CreateUninitializedContext(); 239var context = TestUtils.CreateUninitializedContext(); 253var context = TestUtils.CreateUninitializedContext(); 265var context = TestUtils.CreateUninitializedContext(); 277var context = TestUtils.CreateUninitializedContext(); 289var context = TestUtils.CreateUninitializedContext(); 304var context = TestUtils.CreateUninitializedContext(); 316var context = TestUtils.CreateUninitializedContext(); 337var context = TestUtils.CreateUninitializedContext(options: options); 355var context = TestUtils.CreateUninitializedContext(options: options); 373var context = TestUtils.CreateUninitializedContext(options: options);
OutputCachePolicyProviderTests.cs (17)
47var context = TestUtils.CreateTestContext(testSink: sink); 66var context = TestUtils.CreateTestContext(testSink: sink); 80var context = TestUtils.CreateTestContext(testSink: sink); 96var context = TestUtils.CreateTestContext(testSink: sink); 114var context = TestUtils.CreateTestContext(testSink: sink); 130var context = TestUtils.CreateTestContext(testSink: sink); 144var context = TestUtils.CreateTestContext(testSink: sink); 162var context = TestUtils.CreateTestContext(testSink: sink); 180var context = TestUtils.CreateTestContext(testSink: sink); 198var context = TestUtils.CreateTestContext(testSink: sink); 212var context = TestUtils.CreateTestContext(testSink: sink); 226var context = TestUtils.CreateTestContext(testSink: sink); 245var context = TestUtils.CreateTestContext(testSink: sink); 321var context = TestUtils.CreateTestContext(testSink: sink); 335var context = TestUtils.CreateTestContext(testSink: sink); 355var context = TestUtils.CreateTestContext(testSink: sink); 378var context = TestUtils.CreateTestContext(testSink: sink);
TestUtils.cs (6)
221internal static OutputCacheContext CreateTestContext(HttpContext? httpContext = null, IOutputCacheStore? cache = null, OutputCacheOptions? options = null, ITestSink? testSink = null) 241internal static OutputCacheContext CreateUninitializedContext(HttpContext? httpContext = null, IOutputCacheStore? cache = null, OutputCacheOptions? options = null, ITestSink? testSink = null) 319public string CreateStorageKey(OutputCacheContext? context) 386public ValueTask CacheRequestAsync(OutputCacheContext context, CancellationToken cancellationToken) 393public ValueTask ServeFromCacheAsync(OutputCacheContext context, CancellationToken cancellationToken) 398public ValueTask ServeResponseAsync(OutputCacheContext context, CancellationToken cancellationToken)
OutputCachingSample (1)
Startup.cs (1)
68var cacheContext = context.Features.Get<IOutputCacheFeature>()?.Context;