0

I was trying to find a way to know what percentage of my System.Runtime.Caching.MemoryCache is used. I know how I can configure the limits of the memory cache by using the CacheMemoryLimitMegabytes and PhysicalMemoryLimitPercentage, but my question is how in any moment of my program running I can check what percentage of the defined memory limit is used?

I looked the MS documentation https://learn.microsoft.com/en-us/dotnet/api/system.runtime.caching.memorycache?view=dotnet-plat-ext-6.0, but couldn't find what I was looking for. There are again two properties that get me the limit in bytes and the % of physical memory that can be used, but nothing for the current state.

Tiger Galo
  • 289
  • 4
  • 15
  • Please take the [tour] to learn how Stack Overflow works and read [ask] on how to improve the quality of your question. Please show your attempts you have tried and the problems/error messages you get from your attempts. – Progman Jul 07 '22 at 18:44

1 Answers1

0

I couldn't find any good answer anywhere, seems it's not possible with the means of MemoryCache itself, i.e. no exposed api or whatsoever.

However, I found another stackoverflow ticket with some answers which sounds sufficient for further work and investigation.

Tiger Galo
  • 289
  • 4
  • 15