In a scenario where you want to cache an action result for a specified duration, which attribute or method can be combined with an action result to achieve this behavior?

  • [ResponseCache] attribute
  • [OutputCache] attribute
  • CacheResult() method
  • [Cache] attribute
To cache an action result for a specified duration in ASP.NET Core, you can use the [ResponseCache] attribute. This attribute allows you to specify caching options like cache duration, location, and more at the action method level. By applying this attribute to your action method, you can control caching behavior and improve performance by serving cached responses when appropriate.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *