Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use Cache in webservice?

In my webapplication I have some precalculated values that are stored in Page.Cache. At his moment I have to move this functionality to webservice.

So I need to introduce similiar functionality in webservice - calculate values on first call to web method and store it in Cache.
Is it possible to put some values in Cache (not in Application or Session - I need to purge those values after some time interval) from webservice?

like image 997
Marek Kwiendacz Avatar asked Sep 05 '11 11:09

Marek Kwiendacz


People also ask

Is caching possible in web API?

Caching is very common to make applications performant and scalable. If a result is already computed by the application, it is cached in a store so that next time when the same request comes, cached result can be fetched instead of processing the request again.

What is cache in web services?

Caching refers to storing the server response in the client itself, so that a client need not make a server request for the same resource again and again.


1 Answers

You can always access the Cache through the static HttpRuntime.Cache property, even if you don't have an HttpContext at the moment.

like image 79
Hans Kesting Avatar answered Oct 11 '22 16:10

Hans Kesting