Windows编程:如何在OS缓存中放置经常访问的文件?

时间:2022-09-02 11:03:00

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

Windows编程:如何在OS缓存中放置经常访问的文件?

3 个解决方案

#1


2  

Disclaimer : I dont work all that much under Windows

免责声明:我在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.

在一般情况下,你不应该乱用你的操作系统缓存。它应该足够智能,以缓存经常访问的数据。如果不是,则应使用应用程序级缓存。我不知道你使用的是哪种语言,但很可能你的语言有一个很好的缓存框架。

#2


0  

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

如果您的.net和文件是dll,请查看全局程序集缓存(GAC)。

#3


0  

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.

如果您的文件经常访问并且不是太大,那么它已经存在于许多不同的缓存中。你的语言运行时(例如CRT)缓存,文件系统缓存(或者我认为你的意思是“OS缓存”)和你的硬盘缓存。

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.

如果您的文件很小并且经常访问并且仍然不在缓存中,则它不够小或者访问频率不够高。您可能能够解决第一个问题,但不要尝试修复第二个问题,因为它基本上意味着其他文件的访问频率比您的更频繁,而且很可能是有原因的。例如,用户使用的是另一个应用程序而不是您的应用程序。相信我,它是可能的,它发生了。

#1


2  

Disclaimer : I dont work all that much under Windows

免责声明:我在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.

在一般情况下,你不应该乱用你的操作系统缓存。它应该足够智能,以缓存经常访问的数据。如果不是,则应使用应用程序级缓存。我不知道你使用的是哪种语言,但很可能你的语言有一个很好的缓存框架。

#2


0  

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

如果您的.net和文件是dll,请查看全局程序集缓存(GAC)。

#3


0  

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.

如果您的文件经常访问并且不是太大,那么它已经存在于许多不同的缓存中。你的语言运行时(例如CRT)缓存,文件系统缓存(或者我认为你的意思是“OS缓存”)和你的硬盘缓存。

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.

如果您的文件很小并且经常访问并且仍然不在缓存中,则它不够小或者访问频率不够高。您可能能够解决第一个问题,但不要尝试修复第二个问题,因为它基本上意味着其他文件的访问频率比您的更频繁,而且很可能是有原因的。例如,用户使用的是另一个应用程序而不是您的应用程序。相信我,它是可能的,它发生了。