Using physical memory HttpContext.Cache

Is there a way to find the number of bytes of memory that are currently in HttpContext.Cache?

I found where you can get the physical memory limit using EffectivePrivateBytesLimit or EffectivePercentagePhysicalMemoryLimit, but it's hard for me to find the current use of physical memory.

Any ideas?

--- UPDATE ---

And a few more searches and using the first answer mentioning http://aspalliance.com/cachemanager/ , I went to this page, at the bottom there is a link to http://www.codeproject.com/aspnet/exploresessionandcache.asp , which describes the method calculating the size of the object, which, in my opinion, will be good enough to use.

It basically serializes every object in the cache, and then finds the length of the serialized stream. Summing these values ​​leads to some information that I can use.

+3
source share
1 answer

There is a third-party Cache Manager , which provides tools and statistics for the HttpRuntime cache. You can get memory information there manually, or you can use Reflector to look inside the assembly and see how it collects statistics and do it yourself in your application

+1
source

Source: https://habr.com/ru/post/1721813/


All Articles