I am building a WCF service, I need to store reference data in cache which i will look up every time i receive input from the method... What is the right way to do this? (I would also like to define a expiration policy for the cache that will invalidate it after a certain time interval)
A:
You could take a look at Velocity. This is Microsoft's distributed in-memory caching framework. But this may be a little bit too beta...
Ronald Wildenberg
2009-05-28 17:29:10
A:
You can use System.Web.Cache (even if you're not in a web context), and that's what I'd do. It's basically a big, in memory hash table with some niceties for expiring contents.
MrKurt
2009-05-28 17:33:06
take this or leave it... but this is directly from msdn : The Cache class is not intended for use outside of ASP.NET applications. It was designed and tested for use in ASP.NET to provide caching for Web applications. In other types of applications, such as console applications or Windows Forms applications, ASP.NET caching might not work correctly.
Simon_Weaver
2009-10-13 22:49:45
+2
A:
There are many ways you can do this. One fairly easy is to host the System.Web.Cache object yourself and use that to store the reference data. There's a good example of that here: http://kjellsj.blogspot.com/2007/11/wcf-caching-claims-using.html
tomasr
2009-05-28 17:34:36
A:
The WCF REST Starter Kit has caching, here is an article about using it... with sample code.
Zachary
2009-05-28 17:35:34