Unit 'bufstream' Package
[Overview][Constants][Classes][Index] [#fcl]

TBufferedFileStream.InitializeCache

Re-initializes the internal buffer for the buffered file stream.

Declaration

Source position: bufstream.pp line 145

public procedure TBufferedFileStream.InitializeCache(

  const aCacheBlockSize: Integer;

  const aCacheBlockCount: Integer

);

Arguments

aCacheBlockSize

  

Size for each block (page) allocated in the internal buffer.

aCacheBlockCount

  

Number of blocks (pages) allocated in the internal buffer.

Description

Re-initializes the internal buffer to use the number of blocks (pages) in aCacheBlockCount where each block (page) has the size in aCacheBlockSize.

InitializeCache checks pages in the internal buffer to see if any have been modified, and writes them to the file stream when needed. Memory allocated to an existing buffer page is freed, and the page is discarded.

Values in aCacheBlockCount and aCacheBlockSize are stored internally, and the buffer size is updated to use the size from the file stream.

InitializeCache re-allocates and zero-fills memory used for each of the pages in the buffer prior to exiting from the method.

InitializeCache is called from the Create method to allocate buffer pages using the default count and size for the class.

Use Flush to write modified values in page buffers to the file stream without re-initializing the internal buffer.

See also

TBufferedFileStream.Flush

  

Flushes modified pages in the buffer to the file stream.

TBufferedFileStream.Create

  

Constructor for the class instance.


Documentation generated on: Dec 22 2024