I have a reference data, loaded from database table in ASP.NET application.
I wanted to store some of the records in the cache, but only those that were called by some user, not the whole table.
I considered to options:
1. to store individual items directly in the HttpRuntime.Cache dictionary with some composite string key(e.g. "MyTableName:"+ Row.Key.ToString()).
2. create new Dictionary<KeyType,TableRowType>(), and add the loaded records to the Dictionary. The dictionary itself should be added to HttpRuntime.Cache as one item.
The second way allowed to group related items together and have TypeSafe classes
I've read a few related links:
Improve the performance of your app with ASP.NET caching
My conclusion is to use HttpRuntime.Cache directly with multiple items. It is a proven infrustructure to add/modify items and ASP.NET will be smart enough to remove from cache individual items that were not used for some time.
I still want to review Enterprise Library caching block to check if it has any essential benefits for ASP.NET compare to standard HttpRuntime.Cache.
posted @ Wednesday, October 03, 2007 10:29 AM