views:

99

answers:

3

Windows Programming: How to put a file that is frequently accessed in the OS cache?

+2  A: 

Disclaimer : I dont work all that much under Windows

In the general case, you shouldnt mess with your OS cache. It should be smart enough to cache data that are accessed often. If it isnt, you should use an application level cache. I dont know which language you are using, but most probably there is a good cache framework for your language.

Guillaume
A: 

If your in .net and the file is a dll, look into the Global Assembly Cache (GAC).

DeletedAccount
A: 

If your file is accessed frequently and isn't too large it will already be in a lot of different caches. Your language run-time (e.g. CRT) cache, the file system cache (or what I assume you mean with "OS cache") and your HDD cache.

If your file is small and accessed frequently and still isn't in the cache, it is either not small enough or not accessed frequently enough. You might be able to fix the first problem but don't try to fix the second since it basically means that other files are accessed more frequently than yours and most likely for a reason. For example the user is rather using another application than yours. Trust me, it's possible and it happens.

Andreas Magnusson