如何确定 ASP.Net 缓存的总大小? [英] How to determine total size of ASP.Net cache?

查看:13
本文介绍了如何确定 ASP.Net 缓存的总大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个 web 项目中使用 ASP.net 缓存,我正在为它编写一个状态"页面,显示缓存中的项目,以及我能找到的关于缓存的尽可能多的统计信息.有什么方法可以获得缓存数据的总大小(以字节为单位)?每个项目的大小会更好.我想在网页上显示这个,所以我认为我不能使用性能计数器.

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 find. Is there any way that I can get the total size (in bytes) of the cached data? The size of each item would be even better. I want to display this on a web page, so I don't think I can use a performance counter.

推荐答案

我正在查看我的性能监视器,在 ASP.NET Apps v2.0.50727 类别下,我有以下缓存相关计数器:

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

使用的缓存机器内存限制百分比

使用的缓存 % 进程内存限制

这个类别下还有很多其他缓存相关的指标.

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

这些应该能够为您提供百分比,然后如果您可以通过 Cache.EffectivePrivateBytesLimit 或其他一些调用获得允许的总数,您应该能够弄清楚.我没有使用这些计数器的个人经验,因此您必须进行一些研究和测试以进行验证.

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.

这是一篇关于读取性能计数器的快速入门文章:http://quickstart.developerfusion.co.uk/quickstart/howto/doc/PCRead.aspx

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

这篇关于如何确定 ASP.Net 缓存的总大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆