-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Support output caching #536
Comments
@yishaigalatzer what are the current thoughts on HTTP caching? As MVC is now a unified framework which will also harbor the Web API, that would be something needed there. |
This is currently a need design item. More for tracking a replacement for the old https://aspnetwebstack.codeplex.com/workitem/608 and combine it with the MVC behavior. That really means we haven't spent much time thinking about it yet. So if you have specific ideas for HTTP caching, it's a good place to add them. We are probably going to break this item down to more fine grained items. |
As you might know, I have implemented HTTP Caching in CacheCow library. I am happy to contribute towards building the feature. |
We're thinking of doing something at the middleware layer so that output caching is available to all other middleware components. Then frameworks such as MVC would merely be consumers of the output caching middleware and not implement any such caching on their own. |
Well Output Caching is better than nothing but there is more (way more) to HTTP caching than Output Caching. Output Caching in ASP.NET MVC/Web API is user-mode and not Kernel mode and its rules are usually system-wide (2 requests within 2 minutes or something) and changing them requires registry change. Its capacity bound by the memory available on the server and once threshold reached, it suddenly chucks out half of its content. I would like to see HTTP caching supported as a first class citizen. |
@aliostad whatever we do will likely live in middleware or as part of the HttpAbstractions repository. Mvc will expose those primitives using things like filters. |
@davidfowl sure. So is there another thread somewhere else that we can carry on discussion? |
I look forward to this feature being implemented. I hope it will support Donut Caching where components can be excluded from the parent action's cache. |
Previously in MVC5 we supported OutputCacheProfiles in Web.config which is a pre-defined set of parameters for OutputCache. This provided a way to reuse the settings in multiple controllers/actions and a centralized place manage all Cache profiles. We do not have an equivalent for this in vNext. It looked like this: In Web.config: <caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name="Cache1Hour" duration="3600" varyByParam="none"/>
</outputCacheProfiles>
</outputCacheSettings>
</caching> Accessed in the Action like this: [OutputCache(CacheProfile="Cache1Hour")]
public string Index()
{
return DateTime.Now.ToString("T");
} Proposal for vNext: In Startup.cs services.Configure<MvcOptions>(options =>
{
options.CacheProfiles.Add(new CacheProfile() {
Name = ”Cache1Hour”,
Duration = 3600,
VaryByHeader = “Accept”
});
}); And my action would look like: [ResponseCache(CacheProfile="Cache1Hour")]
public string Index()
{
return DateTime.Now.ToString("T");
} ResponseCache’s |
I think there is still some work to do here. The The I think there needs to be two attributes |
Hi, it looks like you are posting on a closed issue/PR/commit! We're very likely to lose track of your bug/feedback/question unless you:
Thanks! |
Just wanted to guage interest from interested parties before I raised another issue. I've raised #6559 |
How close does https://github.com/aspnet/responsecaching come to fulfilling your in memory caching requirements? It reacts to the headers set by |
We need to design and support output caching for MVC actions. Along with integration to popular caching mechanisms
The text was updated successfully, but these errors were encountered: