A better way to obtain objects from cache

Last week I have posted a better approach to getting field values from an SPListItem. Today I’ve found out that you can actually use almost the same approach to get stuff from the ASP.NET cache.

Once again it’s an extension method which can be used in an intuitive way. The only difference is the type of the key: while getting a field value we’ve been using a GUID and now we’re using a string.

Using the above method you can now easily obtain various items from the cache in a type-safe manner:

Keep it simple!

Technorati Tags: ASP.NET, Cache