user935143
user935143

Reputation: 564

Can i access objects cached in server from Windows service?

I'm caching some objects in code behind in web page i want to implement a windows service that keep refreshing this object with latest data can i access the System.web.caching from windows service?

Upvotes: 0

Views: 254

Answers (2)

Yaakov Ellis
Yaakov Ellis

Reputation: 41500

You cannot use the ASP.net cache as a shared cache between the Windows Service and the Web Site. The Windows Service will not be able to access this.

In order to do what you want, you should use an external cache. For example, set up Redis on the same machine or on a different accessible machine, and access it from the the Windows Service to refresh your data, and from the Web Site to retrieve the pre-cached data.

Upvotes: 1

Lloyd
Lloyd

Reputation: 29668

You could use some kind of web service using a generic handler and have the Windows service talk to that to update items on the web site.

However, personally I'd use an external cache like Couchbase (Memcache) and have both the web site and the Windows service use that instead.

Upvotes: 1

Related Questions