0

Say I have a C# MVC5 Website with multiple MemoryCaches for various different objects, each with a refresh time of about 2 hours.

Say I want to have a progress load bar so that when someone hits the webpage the first time (or the nth time during the 1-2 minutes it takes for all the data to cache) -- I need to display the current MemoryCache loading progress, even if it's just something as fundamental as a Boolean (e.g. False -> display "Data loads 1-2 minutes from cache first session of the morning") to differentiate the screen messaging from just normal latency later in the day.

So to generalize my question: Is there a way to inspect the progress of a long-loading MemoryCache that doesn't wait for it to complete? (Ideally similar messaging would occur again at the 2-hour mark later in the day...)

3
  • Might help if we understood what you're caching that takes 1-2 minutes to get in there. Reference types simple store a reference to an existing object in MemoryCache. Sounds like you need a caching mechanism that persists to disk? Commented Jul 27, 2018 at 16:40
  • It's privileged info so I can't get too specific, but basically a tree like org structure is used to sum financials, which takes some time to run, caching them, such that multiple people can view them depending on their place in said structure. It could be done with a SQL side massive view/join, I suppose, but the tree summing logic is kind of complicated and would require a SQL masters' level knowledge to implement. These numbers can then update throughout the day, hence the need for a certain recency in re-caching periodically. The build-up/computation of the tree is what eats the time. Commented Jul 27, 2018 at 19:43
  • the question lacks details. what is meant by "MemoryCache loading in progress"...the user code just adds CacheItem to the MemoryCache and retrieves items when needed. This is all in-memory. As per the docs , you should create limited number of 'instances' of MemoryCache if at all. Moderators can close this question, as it is stale with no activity! Commented Jan 24, 2023 at 7:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.