As mentioned by others, this is probably happening because of the IIS server Recycling. "Turning off" the recycle can be a turnaround solution to your problem and will work as an emergency solution. But if I were in your pants, after applying this turnaround, I would try different ways to use the memory cache without disabling the recycling process.
Recycling
Recycling is usually* where IIS starts up a new process as a container for your application, and then gives the old one up to ShutdownTimeLimit to go away of its own volition before it's killed.
*- usually: see DisallowOverlappingRotation / "Disable overlapped recycle" setting
It is destructive, in that the original process and all its state information are discarded (including your precious memory cache).
What To Do:
Generally:
- Disable Idle timeouts. 20 minutes of inactivity = boom! New process on the next incoming request. Set that to zero.
- Disable Regular time interval - the "29 hour" default has been described as "insane", "annoying" and "clever" by various parties. Actually, only two of those are true.
- Optionally Turn on DisallowRotationOnConfigChange (above, Disable Recycling for configuration changes) if you just can't stop playing with it - this allows you to change any app pool setting without it instantly signaling to the worker processes that it needs to be killed. You need to manually recycle the App Pool to get the settings to take effect, which lets you pre-set settings and then use a change window to apply them via your recycle process.
That's enough to cause a well-behaved process to live forever. If it dies, sure, it'll be replaced. If it hangs, pinging should pick that up and a new one should start within 2 minutes (by default; worst-case calc should be: up to ping frequency + ping timeout + startup time limit before requests start working again).
Sugestion:
Using out-of-process session state (eg, State Server or a database, or even a cookie if your state is tiny) can allow you to work around this without disabling the recycle.
Hope it helps!