如何确定 ASP.Net 缓存的总大小?

发布于 2024-09-05 02:33:21 字数 146 浏览 2 评论 0原文

我在一个 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

以可爱出名 2024-09-12 02:33:22

没试过。但也许您可以使用ASP.NET 缓存管理器插件。或者用它作为例子。

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

半世晨晓 2024-09-12 02:33:21

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

缓存已使用的计算机内存限制百分比

缓存使用的进程内存限制百分比

此类别下还有许多其他与缓存相关的指标。

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

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文