0

I know that its possible to get the total size of the ASP.net Cache (How to determine total size of ASP.Net cache?)

But is it possible to break down the that total into the individual items stored in cache?

Thanks for your help!

Community
  • 1
  • 1
mga911
  • 1,536
  • 1
  • 16
  • 33
  • Are you using the asp.net in memory cache or a caching service? The .net cache uses a pointer whereas a caching service will need to serialize your data and both of these will result in different object sizes. – Middletone Nov 19 '09 at 23:05
  • I'm using the asp.net cache: HttpContext.Current.Cache.Add() – mga911 Nov 19 '09 at 23:52

1 Answers1

-1

If you just need a one off report then you can serialize each object that is returned and count the bytes.

 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
Middletone
  • 4,190
  • 12
  • 53
  • 74