How to determine total size of ASP.Net cache?

后端 未结 2 1921
忘了有多久
忘了有多久 2020-12-03 02:01

I\'m using the ASP.net cache in a web project, and I\'m writing a \"status\" page for it which shows the items in the cache, and as many statistics about the cache as I can

相关标签:
2条回答
  • 2020-12-03 02:29

    I am looking at my performance monitor and under the ASP.NET Apps v2.0.50727 category I have the following cache related counters:

    Cache % Machine Memory Limit Used

    Cache % Process Memory Limit Used

    There are also a lot of other cache related metrics under this category.

    These should be able to get you the percentage, then if you can get the total allowed with Cache.EffectivePrivateBytesLimit or some other call you should be able to figure it out. I do not have personal experience with these counters so you will have to do some research and testing to verify.

    Here is a quick start article on reading from performance counters: http://quickstart.developerfusion.co.uk/quickstart/howto/doc/PCRead.aspx

    0 讨论(0)
  • 2020-12-03 02:45

    Have not tried it. But maybe you can use Cache Manager plug-in for ASP.NET. Or use it as example.

    0 讨论(0)
提交回复
热议问题