Posted on: 8/13/2013 2:08:10 PM | Views : 296

I am using trying to use perf counters to monitor the HttpRuntime.Cache to see how many items are currently in the cache. This is based on:
http://msdn.microsoft.com/en-us/library/fxk122b4(v=vs.100).aspx
However in Performance Monitor I see the "Cache Total Entries" briefly increase for about a second as I insert into the cache but then it goes back to zero again, i.e. it seems to show a delta not a total.
As a test I'm doing this in a button onclick handler of a brand new asp.net site:
HttpRuntime.Cache.Insert(Guid.NewGuid().ToString(), "Value 1234", null, DateTime.MaxValue, TimeSpan.FromMinutes(5), CacheItemPriority.Default, null);
If I break into the code and look at HttpRuntime.Cache.Count it appears to reflect an accurate number.
Am running Win2K8 R2 SP1, ASP.NET 4.0. Any thoughts appreciated.
...

Go to the complete details ...