如何确定ASP.net缓存项的大小?

时间:2009-11-19 20:19:31

标签: asp.net caching

我知道可以获得ASP.net缓存的总大小(How to determine total size of ASP.Net cache?

但是有可能将该总数分解为存储在缓存中的各个项目吗?

感谢您的帮助!

1 个答案:

答案 0 :(得分:-1)

如果您只需要一次性报告,那么您可以序列化返回的每个对象并计算字节数。

 Dim Stream As New IO.MemoryStream
 Dim FM As New LosFormatter
 FM.Serialize(Stream, Myobject)
 dim O as object = Stream.ToArray
 Trace.Write(O.length) 'The size of the object that you want to measure