Reputation: 3892
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 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.
Upvotes: 3
Views: 874
Reputation: 10296
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).
Upvotes: 2
Reputation: 50672
You could use the caching that is used in ASP.NET and is also available in other .NET applications
Upvotes: 2