Dean Hume - Object Caching - .NET 4

added by deanomachino
10/6/2010 9:50:16 AM


As a developer, we need to use all the tools at our disposal to develop faster and more robust applications. One of the ways we can achieve this is by using caching. Caching is the process of storing frequently used data on the server to fulfil subsequent requests. Now there are a few different types of caching available to the .NET developer, but in this article I am going to discuss data caching using the object cache. The cache object enables you to store everything from simple name / value pairs to more complex objects such as datasets and entire pages. Previously, the cache object used to fall under the System.Web.Caching.Cache namespace. Due to it's power and awesomeness, many developers would copy this namespace into their projects and use it in other applications such as Windows Forms and WPF apps. With the release of .NET 4, the namespace has been refactored and totally rebuilt into the new namespace of System.Runtime.Caching. The old namespace is still available, but any new enhancements will be added to the System.Runtime.Caching namespace.