I use the C # memory cache (System.Runtime.Caching) and it fills up and uses the path more than expected. In any case, to indicate the size that each object in the cache occupies in the cache
I want to encode something similar to this so that I can determine which specific element is causing the problem?
private void ListSizeOfEachItemInCache()
{
foreach {var item in Cache.Items}
{
Console.WriteLine(string.Format(item.Key, item.CacheSize));
}
}
My elements are usually classes that contain collections and have a large graph of objects. However, if I serialize them to disk using a data serializer, they do not seem to fill as much disk space as it seems in RAM. This makes me think of a file cache, it may work better (since items are retrieved from a remote database - not even locally).
private static readonly MemoryCache Cache = MemoryCache.Default;
, , , , , ( , , , , , , ..).