I was browsing through the Caching Application Block in Reflector and stumbled upon the Cache.Flush() method, which the CacheManager.Flush() method invokes. The doc comments for the Cache.Flush() method say the following:
Flush the cache.
There may still be thread safety issues in this class with respect to cacheItemExpirations and scavenging, but I really doubt that either of those will be happening while a Flush is in progress. It seems that the most likely scenario for a flush to be called
is at the very start of a program, or when absolutely nothing else is going on. Calling flush in the middle of an application would seem to be an "interesting" thing to do in normal circumstances.
In my situation I am implementing the "'interesting' thing to do in normal circumstances." Although the MSDN documentation (http://msdn2.microsoft.com/en-us/library/aa480456.aspx)
says the Caching Application Block is "thread safe," the doc comment leads to believe otherwise. Is calling CacheManager.Flush() in the middle of an application's life cycle (when other threads could be accessing information from the cache) a safe bet?