开发者

WCF Per Call Service, needs to implement caching.

Suppose I have a WCF service that is not session or singleton based and is set up as per call. The service needs some information from a file, but this information does not change and only needs to be read once. I don't want every call opening and reading the contents of the file for performance reasons. I would like to cache this data.

How can I make make 开发者_Go百科per call instance WCF service cache this information to avoid opening and reading the file with every call?

Do I need a separate caching service/component? We are using .Net 4.

One thing I have looked at is the possibility of using the AppFabric caching service, but maybe there is something simplier.


You could use the caching that is used in ASP.NET and is also available in other .NET applications


Since your use case appears to not require any cache invalidations you can safely use HttpRuntime.Cache for that purpose - even with multiple server instances. But as soon as you begin caching stuff that also needs to be consistent accross multiple servers I would recommend switching to the AppFabric Cache (formerly known as Velocity).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜