다음을 통해 공유


CreateCache (Windows CE 5.0)

Send Feedback

This function creates a new cache.

DWORDCreateCache(HANDLEhDsk, DWORDdwStart,DWORD dwEnd,DWORD dwCacheSize,DWORD dwBlockSize,DWORD dwCreateFlags);

Parameters

  • hDsk
    [in] Handle to the disk to cache.

  • dwStart
    [in] Starting block number of the disk to cache.

  • dwEnd
    [in] Ending block number of the disk to cache.

  • dwCacheSize
    [in] Number of blocks the cache can hold.

  • dwBlockSize
    [in] The size of a block, in bytes. This value is typically equal to the sector size of the disk, although this is not required.

    The block size must be a power of 2 and less than the buffer size, which is set to 64 KB by default.

  • dwCreateFlags
    [in] The following table shows the possible values for dwCreateFlags.

    Value Description
    CACHE_FLAG_WARM Warms the cache.

    This preloads the cache starting with the dwStart value, until the cache is filled.

    CACHE_FLAG_WRITEBACK Enables write-back mode for the cache.

    If not specified, the default is write-through mode.

    Upon creation of the cache in write-back mode, a low priority thread is created, which commits dirty blocks.

Return Values

On success, returns a cache ID value that is used in the other Cache Manager Functions.

On failure, returns INVALID_CACHE_ID. An error most likely occurs due to an invalid parameter or a lack of memory.

Remarks

Each buffer for the cache is allocated one at a time.

If the memory allocation for a specific buffer fails, the size of the successful buffers allocated becomes the cache size.

If no buffer can be allocated, the cache is of size zero and all read and write requests go directly to the disk.

Requirements

OS Versions: Windows CE 5.0 and later.
Header: Fsdmgr.h.
Link Library: Fsdmgr.lib.

See Also

Cache Manager Functions

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.