Connecting the developer community through conferences, user groups and training.

Wednesday, September 5, 2018

Using Caching in the .NET Framework

Caching is easy to use in the .NET Framework

According to Microsoft:

"In the .NET Framework 3.5 and earlier versions, ASP.NET provided an in-memory cache implementation in the System.Web.Caching namespace. In previous versions of the .NET Framework, caching was available only in the System.Web namespace and therefore required a dependency on ASP.NET classes. In the .NET Framework 4, the System.Runtime.Caching namespace contains APIs that are designed for both Web and non-Web applications."

Here are a couple methods to Load and Save from the Memory Cache. If the value is not found, it will be null.