Can I have the return value of a WebMethod outputcached? E.g. if the WebMethod has been called in the last X seconds or minutes, don't actually run the method again--just use the same result as it last served. Or should I roll my own caching internally in the class/WebMethod?
.NET: Output caching for WebMethod?
Asked Answered
You can use the CacheDuration parameter of the WebMethod attribute to specify that the output of the request is cached for a given amount of time.
[WebMethod(CacheDuration=60)]
The above code would make your webmethod cache its results for 60 seconds.
© 2022 - 2024 — McMap. All rights reserved.