Can Cache be used in webservice?

In my web application, I have some pre-calculated values โ€‹โ€‹that are stored in Page.Cache. At this point, I need to move this functionality to the webservice.

So, I need to introduce similar functions in the webservice - calculate the values โ€‹โ€‹the first time the web method is called and save it in the cache.
Is it possible to put some values โ€‹โ€‹in the cache (not in the application or session - I need to clear these values โ€‹โ€‹after a certain period of time) from the webservice?

+5
source share
4 answers

HttpRuntime.Cache, HttpContext .

+7

- , -. . , - ASP.NET, ASP.NET - HttpContext.Current.Cache.

- WCF, (BTW, - ASP.NET , - WCF ). WCF ASP.NET, ASP.NET . WCF ASP.NET, , , API - , System.Runtime.Caching, .NET 4 (. ), .

+5

:

HttpContext.Current.Cache.Insert(strName, objItem, null,
     DateTime.Now.AddMinutes(intMinutes), Cache.NoSlidingExpiration)

.

+2

- XML

, , . , , .

+1

All Articles