How can I use System.Web.Caching.Cache in a Console application?

后端 未结 6 584
死守一世寂寞
死守一世寂寞 2021-02-01 03:47

Context: .Net 3.5, C#
I\'d like to have caching mechanism in my Console application.
Instead of re-inventing the wheel, I\'d like to use System.Web.Caching.Cache

6条回答
  •  失恋的感觉
    2021-02-01 04:12

    While the OP specified v3.5, the question was asked before v4 was released. To help anyone who finds this question and can live with a v4 dependency, the framework team created a new general purpose cache for this type of scenario. It's in the System.Runtime.Caching namespace: http://msdn.microsoft.com/en-us/library/dd997357%28v=VS.100%29.aspx

    The static reference to the default cache instance is: MemoryCache.Default

提交回复
热议问题