Depending on how many files you have or how often you have to read them, I would suggest dynamically loading into the asp.net cache AS you need them and having some type of expiry or the cache.
Write some type of class to wrap you file access and caching implementaton. This code will probably work but don't use it as is, it's just to give you an idea of what I am talking about. Please not all the comments for improvements.
public static class StaticFiles
{
public static string GetFile(string file)
{
// Note filename is the key
if (Cache[file] != null)
{
// Return the cached data, this will be fast.
return Cache[file].ToString();
}
else
{
// Make sure you do some exception checking / validation here for the
// file data and don't hard code the path and make it relative assuming
// it is in your application directory
// Do you file access and store it with some type of expiry
string output = System.IO.File.ReadAllText(string.Format("c:\path\to\{0}", file));
Cache[file] = output;
return output;
}
}
}
You should consider your cache expiry and see what would best suit your data. You could also implement some type of max check to allow a maximum number of cached files so the memory foot print doesn't get to big if you expiry is long. You really need to look at your total number of files and their size and figure out what would best suit your needs.