1
Vote

DirectoryNotFoundException if ConcurrentCache directory is deleted

description

If the ConcurrentCache directory is deleted from the server while the site is running a DirectoryNotFoundException will be thrown

comments

dotnetchris wrote Jun 16, 2010 at 7:09 PM

Some extra information, this error appears to be entirely induced by ConcurrentCache, I have the cache mode on Auto and it appears that ConcurrentCache will randomly remove the entire ConcurrentCache directory and then this error will occur.

InvertedSoftware wrote Jun 27, 2010 at 3:28 AM

Chris,
This was done on purpose. It’s not a bug. I could have put extra two lines of code there
if (!Directory.Exists(Utils.CacheLocation))
            Directory.CreateDirectory(Utils.CacheLocation);
every time I read or write to a file but, that will take away from the performance. The cache folder is recreated on app start and should not be deleted at runtime. If you like to change that, please download a copy of the code and modify it for you own use. I think that this trade off is worth the performance gain. If I get more requests to change this functionality I will do that.

Thanks
Gal

InvertedSoftware wrote Jun 27, 2010 at 3:35 AM

Oops. I did not read the comment at the bottom. I think your app pool is recycling itself. I took the code that deletes the cache directory out and now it just checks if the directory exists. If it doesn’t exist, it will create it on app start. I uploaded new source and binaries. Let me know if that solved your problem.
Gal

dotnetchris wrote Jul 16, 2010 at 3:09 PM

Why should it create the directory on app load? That would completely eliminate being able to cache across app recycles. What's the point of having file based caching that dies with an app reset?

InvertedSoftware wrote Jul 17, 2010 at 1:29 AM

The point was to clear the cache when you recycle the app pool. Your app pool recycles itself, which means, you are hitting your app pool memory limit. In any case please read my comments again, I removed the code that clears the cache directory so I don’t understand what you are requesting here.
Gal

wrote Feb 12, 2013 at 11:43 PM