日期:2014-05-17 浏览次数:20945 次
public const ulong FILE_CACHE_MAX_HARD_ENABLE = 0x00000001;
public const ulong FILE_CACHE_MAX_HARD_DISABLE = 0x00000002;
public const ulong FILE_CACHE_MIN_HARD_ENABLE = 0x00000004;
public const ulong FILE_CACHE_MIN_HARD_DISABLE = 0x00000008;
[DllImport("Kernel32.dll", SetLastError = true)]
public static extern bool GetSystemFileCacheSize(out ulong lpMinimumFileCacheSize
, out ulong lpMaximumFileCacheSize
, out ulong lpFlags);
[DllImport("Kernel32.dll", SetLastError = true)]
public static extern bool SetSystemFileCacheSize(ulong MinimumFileCacheSize, ulong MaximumFileCacheSize, ulong Flags);
ulong lpMinimumFileCacheSize = 1048576;
ulong lpMaximumFileCacheSize = 1048576 * 1024;
bool isok = SetSystemFileCacheSize(lpMinimumFileCacheSize, lpMaximumFileCacheSize, FILE_CACHE_MAX_HARD_ENABLE | FILE_CACHE_MIN_HARD_ENABLE);