title: MemoryCache - prevent expiration of items
body: <p>In my application I use MemoryCache but I don't expect items to expire. Items are therefore inserted to the cache with default policy, without <code>AbsoulteExpiration</code> or <code>SlidingExpiration</code> being set.</p>
  
  <p>Recently, on high server last, I experienced problems with cache, as it returned null values in place of desired values, inserted to the cache before. It turned out, that not only items eligible to expire (as those with expiration date explicitly set) are removed from the cache. Under memory pressure, where values of <code>CacheMemoryLimit</code> and/or <code>PhysicalMemoryLimit</code> are exceeded, MemoryCache removes other elements as well.</p>
  
  <p>How to prevent this? How to be sure, that when element is set to the cache once, it can be safely fetched from it again?</p>
  
  <p>I considered setting the <code>PollingInterval</code> to some huge value, but this only delays the potential problem (and the polling interval is referenced in documentation as maximal time, not the exact or minimal time). Setting <code>PhysicalMemoryLimitPercentage</code> to 100% also does not solve the problem since it references to the physically installed memory and not to the whole available virtual memory. Or am I wrong and it would indeed help?</p>