Run time cache settings

This topic describes the rum time cache settings.

Read caching

A client, or multiple clients, may issue repeated requests to read data from the same locality within a file. Data that has been read previously that is still in the cache can be returned to the client without continuously re-reading the data from the media.

Note: Read caching has little benefit when files are accessed sequentially in large blocks, and are never re-read.

Read ahead caching

Read ahead caching builds on read caching by detecting clients that are performing streaming operations and speculatively reading ahead on the assumption that, once the data is in the cache it is likely to be accessed in the near future, thus improving performance.

Write caching

Write caching is implemented to perform a small level of write back caching that overcomes the inefficiencies of clients that perform small write operations by consolidating multiple file updates into a single larger write operation, thus taking advantage of media that is written on a block basis as well as minimizing the overhead of metadata updates that the file system performs.

Opening files with different modes

The system is configured by partners. Read caching, read ahead caching and write caching are set on a per drive basis and are one of three states, these are:

  • ON

  • ENABLED

  • OFF

If caching is set to ENABLED or ON for a drive by the partner then you, as the client, can enable or disable caching at run-time on a per file basis. However, if caching is set to OFF it cannot be altered at run-time. The TFileMode enumeration supports the run time file caching configurations. The file open modes are as follows:

EFileWriteBuffered  =0x00000800, // Enables write buffering
EFileWriteDirectIO  =0x00001000, // Disables write buffering
EFileReadBuffered   =0x00002000, // Enables read buffering
EFileReadDirectIO   =0x00004000, // Disables read buffering
EFileReadAheadOn    =0x00008000, // Enables read ahead 
EFileReadAheadOff   =0x00010000  // Disables read ahead

If the values above are not specified when a file is opened then these default settings are used:

  • if caching is set to ENABLED for a drive by the partner then caching is OFF by default

  • if caching is set to ON for a drive by the partner then caching is ON by default

Note: If caching is set to OFF for a particular drive by the partner, caching cannot be enabled.

Use the TFileMode values with the following functions to alter the way in which an open file is accessed.

  • RFile::Open()

  • RFile::Create()

  • RFile::Replace()

  • RFile::Temp()