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>
Just use the Caching Application Block if you don't want to reinvent the wheel. If you still want to use the ASP.NET cache- see here. I'm pretty sure this only works with .NET 2.0 and above though. It simply wasn't possible to use the cache outside of ASP.NET in .NET 1.
MSDN has a nice big warning on the page for the cache documentation too:
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.
For a very lightweight solution, where you don't have to worry about expiration etc, then a dictionary object could suffice.